multiple inclusion of header files accross

Eljay Love-Jensen eljay@adobe.com
Mon Sep 15 19:49:00 GMT 2003


Hi Aaron,

In typical C/C++ files, header files should not generate any bytes of output.  Declarations are okay, instantiated definitions are not.

 From Stroustrup's C++PL section 9.2.1

As a rule of thumb, a header may contain:
+ named namespaces
+ type definitions
+ template declarations
+ template definitions
+ function declarations
+ inline function definitions
+ data declarations
+ constant defintions
+ enumerations
+ name declarations (forward declarations)
+ include directives
+ macro definitions
+ conditional compilation directives
+ comments

Conversely, a header should never contain:
+ ordinary function definitions
+ data definitions
+ aggregate definitions
+ unnamed namespaces
+ exported template definitions

HTH,
--Eljay




More information about the Gcc-help mailing list