I\'m implementing The X macro, but I have a problem with a simple macro expansion. This macro (see below) is used into several macros usage examples, by including in this articl
.
separates tokens and so you can't use ##
as .red
is not a valid token. You would only use ##
if you were concatenating two tokens into a single one.
This works:
#define X(a, b) foo.a = -1;
What's a valid proprocessing token? Can someone explain this?
It is what gets parsed/lexed. foo.bar
would be parsed as 3 tokens (two identifiers and an operator): foo . bar
If you use ##
you would get only 2 tokens (one identifier and one invalid token): foo .bar