Question about including files and a generic header file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jajjo
    New Member
    • May 2009
    • 26

    Question about including files and a generic header file.

    Hey there,

    I'm just wondering something. If I created a generic header file that contained all of my inclusions that I needed and then just included that one file in all subsequent files, would it be safe?

    I know it would TECHNICALLY work, but my concern is that it would bloat the program, create errors from some inclusion exception or if it is just frowned upon in the industry for some reason.

    Any advice on whether or not to do this is much appreciated.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    That is one of those personal choice things. Some people frown on such an approach and some people like it.

    It will (well should) not bloat your program, the program is made from executable code, generally this is the code that appears in your source files.the headers just contain definitions of symbols (types, functions, variables and preprocessor) which is information for the compiler rather than source code that produces executable code.

    What you may find (if it is a lot of files) is that it slows down compilation. How critical this is depends on the number and size of the headers which effects how much the compilation slows for a single file and the number of source files in your project.

    For example if you get just a half second slow down in compilation of a project with 1000 source files that equates to 8 minutes more compilation time for a complete build.

    Comment

    • Jajjo
      New Member
      • May 2009
      • 26

      #3
      Right on, thanks for the input :)

      Comment

      Working...