9fans archive / 2000 / 08 / 66 /    prev next

From: "Douglas A. Gwyn" <dagwyn@hom...>
Subject: Re: [9fans] Installing the updates
Date: Wed, 2 Aug 2000 09:39:05 GMT

Greg Hudson wrote:
> a low cost (and one which can be optimized away for ifdef-protected
> headers; I'm told gcc does so).

The general trick is for the preprocessor to maintain
a table of (lock_symbol,header_name) entries, and when
a new header file is read, to make a note whether it
consists of <white>#ifndef symbol...#endif<white>
(after comment processing).  If so, the symbol and
file name go into the table.  #include processing
always checks the table and if there is an entry for
the file, if the associated lock_symbol is defined,
the file is not even opened.  This trick does no harm.