Subject: Re: missing #include ?
To: None <tech-userlevel@NetBSD.org>
From: Pavel Cahyna <pavel@NetBSD.org>
List: tech-userlevel
Date: 12/10/2006 23:02:11
On Sun, Dec 10, 2006 at 09:45:39PM +0100, Hauke Fath wrote:
> 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.
"CPP optimizes even further. It remembers when a header file has a wrapper
`#ifndef'. If a subsequent `#include' specifies that header, and the macro
in the `#ifndef' is still defined, it does not bother to rescan the file
at all."
(http://gcc.gnu.org/onlinedocs/gcc-4.1.1/cpp/Once_002dOnly-Headers.html)
Pavel