What does this statement do? I know ## concatenates and I know the converts macro parameters to string literals, but overall I'm not sure what this statement does. Any help would be appreciatede.
#name takes the parameter name and turns it to a string literal. ## takes two separate tokens and combines them into one.
For example... if you were to say:
ADD_TOKEN_LIST(foo)
That would expand to the below:
1 2 3 4 5 6 7 8
{ "Xig""foo""token", Xigfootokens }
^ ^
| |
| ## name ##: name gets replaced with foo
| then the ##s make the foo 'join' with the tokens around it
|
|
#name takes the given name 'foo' and turns it into a string literal
Also... in C and C++... two string literals that are declared next to each other like that are automatically joined. This is true everywhere, not just in macros.
So "Xig""foo""token" essentially becomes "Xigfootoken"