C99: "Despite the name, the preprocessing directive is not a directive."

What does the quoted footnote mean in the title? This footnote is attached to 6.10.3p11

If the argument list contains sequences of preprocessing tokens that would otherwise act as preprocessing directives, 147) the behavior is undefined.

I checked and found

The preprocessing directive consists of a sequence of preprocessing tokens, which begins with the #processing token #, which ...

and I did not find the non-contact non-directivematching this syntax. It can, but does not have to, start with a #pre-processing token . So, are we going to say the following?

"Despite the name, the preprocessing directive is not a directive."

Also, what is the purpose of this footnote?

+5
source share
2 answers

See http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_250.htm . To find out what

#define nothing(x) // Nothing    /* Case 1 */
nothing (
#nonstandard
)

- UB.

+7
source

My copy of C99 does not have this footnote (this is the original - do you have TR fixes?), But I think the idea is that if you have

# non-directive

inside the argument list of a macro that still works undefined.

It would be better to do <non-directive> production includes #, I think, it will simplify 6.10p3.4, and also eliminate this confusion.

+4
source

All Articles