Avoiding Double Header Includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The cpp manual states:

<quote>
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.
</quote>

Does that mean (1) the file is reopened but not scanned,  or (2) does
it mean the file is not even opened?  It seems that (1) is probably
the correct answer, but I'm looking for confirmation.

It makes a slight difference efficiency-wise, and there is a cpp
"#pragma once" that will definitely avoid reopening the header after
the first time it's read.

Thanks,

-Tom

Thomas M. Browder, Jr.
Niceville, Florida
USA


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux