Re: Debug size + PCH = Pb ! ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sébastien,

Whenever I see header files that generate big object code, I think to myself "Hmmm, header files (by and large) should specify declarations.  If they instantiate anything in the header file, that instantiation can incur multiple instances.  Those multiple instances can occur for every single translation unit.  Next thing you now, your application is 1.3 gigabytes in size."

In Bjarne Stroustrup's C++ Programming Language book (special edition, or third edition) he lists out what kinds of things belong in header files.  Section 9.2.1, to recap:

A header file may contain...
+ named namespaces
+ type definitions
+ template declarations
+ template definitions
+ function declarations
+ inline function definitions
+ data declarations
+ enumerations
+ name declarations
+ include directives
+ macro definitions
+ conditional compilation directives
+ comments

I presume you are well aware of the difference between a declaration and a definition.

I also presume you are aware of the difference between a template definition and a template instantiation; likewise with inline function definitions and their use.

In my opinion, "things that cause the compiler to generate bytes" go in source files (.cpp) and only in source files.

A book that will help you tremendously to manage a large project is Large-Scale C++ Software Design by John Lakos (http://www.amazon.com/exec/obidos/ASIN/0201633620).

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux