What does the quoted footnote in the title mean? It's a footnote attached to 6.10.3p11
If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as preprocessing directives,147) the behavior is undefined.
I checked up and found
A preprocessing directive consists of a sequence of preprocessing tokens that begins with a # preprocessing token that ...
and I didn't find the non-terminal non-directive
matching that syntax. It can, but doesn't have to, start with a #
preprocessing token. So wouldn't we have to say the following?
"Despite the name, a preprocessing directive is a non-directive."
Also, what is the purpose of that footnote?
See http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_250.htm It is to clarify that
#define nothing(x) // Nothing /* Case 1 */
nothing (
#nonstandard
)
is UB.
My copy of C99 doesn't have that footnote (it's the original - do you have one with TR corrections applied?) but I think the idea is that if you have
# non-directive
inside a macro argument list, that's still undefined behavior.
It would have been better to make the <non-directive> production include the #
, I think, it would simplify 6.10p3,4 as well as removing this confusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With