HarryW
Feb 14th, 2001, 09:42 AM
I'm used to seeing header files included in source files, and to see header files included in header files. However, when you have lots of source files, it seems more sensible to include the source files in one main file, with all the headers included at the top, rather than including all the header file info at the top of every source file.
I've heard of people doing this, but it just seems really odd that you would #include source files. Seems to be missing the point somehow.
Is there a standard way to do this? I just started wondering about it again since you generally add the #ifndef, #define, #endif around header files to stop them being included more than once. What if you have the headers included in more than one source file? Perhaps it doesn't matter because the compiler/linker (can't remember which) sorts out the project, since if the code has already been included in another file you don't need to include it again in the other file.
:confused:
Anyone care to comment on standard ways of going about this whole structuring malarkey?
I've heard of people doing this, but it just seems really odd that you would #include source files. Seems to be missing the point somehow.
Is there a standard way to do this? I just started wondering about it again since you generally add the #ifndef, #define, #endif around header files to stop them being included more than once. What if you have the headers included in more than one source file? Perhaps it doesn't matter because the compiler/linker (can't remember which) sorts out the project, since if the code has already been included in another file you don't need to include it again in the other file.
:confused:
Anyone care to comment on standard ways of going about this whole structuring malarkey?