STL include file guard names

Nathan Myers ncm-nospam@cantrip.org
Fri Jul 30 18:51:00 GMT 2004


On Fri, Jul 30, 2004 at 08:30:26PM +0200, Gabriel Dos Reis wrote:
> Ed Rice-Senior Programmer PGS Software Perth <ed.rice@pgs.com> writes:
> | I noticed that the STL header file guard macro names in the version of
> | libstc++ that ships with gcc 3.4.1 have changed compared to those that
> | shipped with gcc 3.3.3.  For example in
> | include/c++/3.4.1/bits/stl_set.h the header guard is
> | 
> | #ifndef _SET_H
> | #define _SET_H 1
> | 
> | ... Is there a reason for the change? It seems to me that the 
> | 3.3.3 style has the benefit of being much less likely to clash 
> | with other libraries.
> 
> Which others?  The name space _[A-Z].* is reserved to the
> implementation. 

I think there are ports of g++ to environments that have their own
"implementation" header files which justifiably use the same namespace,
and are included by libstdc++ headers and compilation units, as well 
as by user programs that also include ours.  There is no merit I can 
see in short include-guard names (and little much merit in uniformity,
either).  I'd rather see a random ten-letter suffix on each one, just 
to be sure, but a long-enough projectwide prefix or suffix probably 
suffices.

Nathan Myers
ncm@cantrip.org



More information about the Libstdc++ mailing list