Subject: | namespace cleanliness in k5-platform.h |
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.)
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.)