Subject: Re: missing #include ?
To: Hubert Feyrer <>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: tech-userlevel
Date: 12/10/2006 21:45:39
At 21:02 Uhr +0100 10.12.2006, Hubert Feyrer wrote:
>On Sun, 10 Dec 2006, Hauke Fath wrote:
>> How much of a performance penalty would we take on {slow,
>> memory-limited} machines?
>The situation we're talking about is: foo.h needs sys/types.h to work
>properly, and if foo.h should include sys/types.h, or if the application
>pulls it in.


>Where is the performance difference?

With the way unix includes are done traditionally, the #include is
unconditional. Even if <sys/types.h> has been pulled in two dozen times
before by other headers, cpp will still read the file once more, just to
ignore its content.

Obviously, this is not an issue on a 3 GHz machine with a GB of RAM, which
will have everything and their dog in the file cache. But it'll be
different on a VAX or m68k machine with 16 MB RAM.


"It's never straight up and down"     (DEVO)