Sign in to follow this  
Daos

Question about style

Recommended Posts

Sounds ok to me.

I usually have a StdHeader.h file which includes all the common stuff (like the STL libraries, memory mangement etc) and then include this in all of my other headers. If another header is needed in a file, I simply include it there instead of the StdHeader file.

Edit: To say, like Agony says - my StdHeader.h doesn't change very often at all, otherwise you WILL see huge slowdown in compilation.

Share this post


Link to post
Share on other sites
I suppose it could be considered okay. It'll probably be wise to avoid as many globals as you can, though. In addition, if nearly every .c/.cpp file includes this common header file, then every time you need to alter this header file, you'll have to do a full re-compile of every single object file, which could potentially become slow. But if you're willing to live with that and/or don't plan on changing the file often, I'd say you'd be good.

Share this post


Link to post
Share on other sites
No. Do not do that.

If your project is tiny and you plan on never sharing the files between projects, then it probably won't hurt. However, if you do that in the real world, your co-workers will complain about it, and laugh at you and make jokes about what a noob you are.

The exception is using pre-compiled header files.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by JohnBolton
if you do that in the real world, your co-workers will complain about it, and laugh at you and make jokes about what a noob you are.


maybe awakening some bad memories?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this