This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Names of header include guards


I just ran into a problem because the include guard on the C++ ctime
header file changed from _CPP_CTIME to _CTIME.  The problem is that the
HP header files use the macro _CTIME as a guard around the function
ctime() and this conflicts with the g++ use of it as a file level
include guard on the ctime header file.  I can obviously use the fixinc
mechanism to tweek the HP header file but I thought I would see if it
were possible to convince people that the the include guard should
change instead.

HP uses _XYZ_INCLUDED for a header file called xyz.h, by having the
_INCLUDED on the end of all header file include guards it puts them in
their own namespace (so to speak).  This seems like a useful idea, any
chance of doing something similar for gcc/g++ header files?  I notice
that many of the C files already use _H as a suffix on their file
level include guards.  This presumably matches the .h of the file,
but C++ headers don't use .h.

The headers in include/backward all start with _BACKWARD and the files
in c_compatibility directory use _GLIBCXX as a prefix, but the files in
include/c and include/c_std in the libstdc++-v3 directory don't have any
prefix other then an underscore, nor do they have a standard suffix.

What do people think?  A lot of these guards are pretty generic names
that could easily conflict with macros in other system headers on HP-UX
or other systems, epecially the ones in include/std like _SET, _LIST,
_STACK, or _VECTOR.

Steve Ellcey
sje@cup.hp.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]