SBeaulieu
May 26th, 1999, 10:42 AM
Can anybody tell me why it would be bad to include headers within other headers? Where I work it's policy, but I believe that if we take the simple precaution of using the
#ifndef _HEADER_XXXX_
#define _HEADER_XXXX_
#endif
construct, there would be no problems and it would simplify including, say, a class that needed certain structures. As long as you only include what you NEED, there should be no problems.
And it would save having to include headers with the structures the class needs before including the class, in EVERY c file that uses that class.
So if any one can come up with a case where including headers within headers causes problems that wouldn't be present if not the case, please let me know. Whether they be managability, compile problems, etc. (And where every header includes the above construct, and that inclusion is done above braindead level)
Thanks for your help
#ifndef _HEADER_XXXX_
#define _HEADER_XXXX_
#endif
construct, there would be no problems and it would simplify including, say, a class that needed certain structures. As long as you only include what you NEED, there should be no problems.
And it would save having to include headers with the structures the class needs before including the class, in EVERY c file that uses that class.
So if any one can come up with a case where including headers within headers causes problems that wouldn't be present if not the case, please let me know. Whether they be managability, compile problems, etc. (And where every header includes the above construct, and that inclusion is done above braindead level)
Thanks for your help