* RE: multiple inclusion of header files accross
@ 2003-09-15 21:15 lrtaylor
0 siblings, 0 replies; 3+ messages in thread
From: lrtaylor @ 2003-09-15 21:15 UTC (permalink / raw)
To: aaron.case, gcc-help
Aaron,
Are you experiencing problems that you believe is due to these multiple inclusions, or what is your main goal here that is driving you to get the number of inclusions down?
Thanks,
Lyle Taylor
IS Applications
-----Original Message-----
From: Aaron Case [mailto:aaron.case@dynazign.com]
Sent: Monday, September 15, 2003 1:12 PM
To: gcc-help@gcc.gnu.org
Subject: multiple inclusion of header files accross
Hello,
Is there a ld switch to address the problem of multiple inclusion of header
files accross object files. I have used #ifndef and #define to prevent
multiple inclusion within an object file successfully.
Or should this be address in the makefile? The current structure of the
makefile compiles several objects and then links the objects together but,
but some header files are included in almost all the source files used to
make each object.
Or should this be addressed by reorganizing my header files and throwing in
a few extern keywords?
Thanks in advance?
Aaron Case
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: multiple inclusion of header files accross
2003-09-15 19:11 Aaron Case
@ 2003-09-15 19:49 ` Eljay Love-Jensen
0 siblings, 0 replies; 3+ messages in thread
From: Eljay Love-Jensen @ 2003-09-15 19:49 UTC (permalink / raw)
To: Aaron Case, gcc-help
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* multiple inclusion of header files accross
@ 2003-09-15 19:11 Aaron Case
2003-09-15 19:49 ` Eljay Love-Jensen
0 siblings, 1 reply; 3+ messages in thread
From: Aaron Case @ 2003-09-15 19:11 UTC (permalink / raw)
To: gcc-help
Hello,
Is there a ld switch to address the problem of multiple inclusion of header
files accross object files. I have used #ifndef and #define to prevent
multiple inclusion within an object file successfully.
Or should this be address in the makefile? The current structure of the
makefile compiles several objects and then links the objects together but,
but some header files are included in almost all the source files used to
make each object.
Or should this be addressed by reorganizing my header files and throwing in
a few extern keywords?
Thanks in advance?
Aaron Case
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-15 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-15 21:15 multiple inclusion of header files accross lrtaylor
-- strict thread matches above, loose matches on Subject: below --
2003-09-15 19:11 Aaron Case
2003-09-15 19:49 ` Eljay Love-Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).