.
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