ron minnich wrote: > Is this construct portable at this point? c99 or whatever? Or is it > gcc-centric? > #if defined(_INCLUDED_GASNET_INTERNAL_H) && !defined(_IN_GASNET_INTERNAL_H)
That code could be used in a C99 program, but those identifiers do not have standard meanings. My guess is that you found that in a header that uses one of the identifiers as an "idempotency lock: to prevent the contents of the header from being processed more than once no matter how many times the header is included. Usually that is needed only when a header defines a typedef name. The use of the other identifier is less clear, but is probably something similar but in the opposite sense. This idiom works in general, except that identifiers starting with _ are (in this context) reserved for the C implementation and should not be used in "user" source files. /* start of file foo.h: */ #if !defined(INCLUDED_FOO_H) // could use #ifndef for single test #define INCLUDED_FOO_H // idempotency lock; won't get here later ...declarations and definitions here, including typedefs... #endif /* end of file foo.h */
