Question about style

Started by
4 comments, last by GameDev.net 19 years, 7 months ago
Hi,i'm working on a project and i need to know if it's Ok to use a common header file where i place all my needed externs. ThanX!
Advertisement
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.
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.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Ok then header it is...
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.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
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?

This topic is closed to new replies.

Advertisement