tobold.org

correct • elegant • free

△ Comp.lang.c △

◅ Free() memory??

A useful strcat function ▻

Q: Nested includes good or bad?

In article <clcm-20000629-0001@plethora.net>,
mike burrell  <mikpos@home.com> wrote:
>personally, i like nested includes, and the only reason i've found against
>it is possibly increased compilation time (e.g. if a translation unit
>includes the same header file 13 times (which would not be uncommon), then
>the compiler might have to run through a few thousand blank lines, not to
>mention that extra time the preprocessor has to spend).

Note that if you protect your include files with the usual...

    #ifndef _STDIO_H
    #define _STDIO_H 1
    ...
    #endif

...then gcc, at least, will only read the file once.  (It remembers that
the entire file was conditional on that symbol, and if asked to read it
again, when the symbol is defined, just skips it.)

If your compiler doesn't feature this rather obvious optimization, ask
your vendor why not!  (Or switch to gcc, of course...)

Tim.
--
Tim Goodwin   | "Not ideal, I grant you, but life's
Leicester, UK | like that." -- Ian Batten
--
comp.lang.c.moderated - moderation address: clcm@plethora.net

Original headers:

Subject: Re: Q: Nested includes good or bad?
Approved: clc@plethora.net
References: <clcm-20000628-0004@plethora.net> <clcm-20000629-0001@plethora.net>
From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.lang.c.moderated,comp.lang.c
Message-ID: <clcm-20000629-0018@plethora.net>
Date: 29 Jun 2000 22:40:22 GMT

△ Comp.lang.c △

◅ Free() memory??

A useful strcat function ▻