[krbdev.mit.edu #2603] namespace cleanliness in k5-platform.h

Tom Yu via RT rt-comment at krbdev.mit.edu
Thu Jun 17 18:36:36 EDT 2004


k5-platform.h contains a number of instances of JOIN2(foo, __bar).  This
can cause a macro in the reserved namespace to get expanded.  It might
be better to make a macro such as

#define JOINX__Y_2(x,y) x ## _ ## _ ## y
#define JOINX__Y(x,y) JOINX__Y_2(x,y)

or something like that, so that macros in the reserved namespace don't
get expanded.  The example above doesn't use x ## __ ## y because that
might still invoke undefined behavior. (prefixes _[A-Z_] are reserved
for any use, while prefixes _[^A-Z_] are only reserved for file scope
ordinary and tag identifiers.  It's conceivable, though perhaps
unlikely, that an compiler vendor could implement a preprocessor
extension using identifiers with a prefix of the form _[A-Z_], e.g., the
__VA_ARGS__ facility in c99.)


More information about the krb5-bugs mailing list