My code
int main()
{
PASTE(1, (1+3)/4);
return 0;
}
I would like to get the result
int main()
{
11;
return 0;
}
Compiled link: http://coliru.stacked-crooked.com/a/b35ea3e35a1b56ae
I introduced two levels of indirection suggested. How can I guarantee full macro decomposition of a parameter before insertion? .
But still, I get a preprocessor error:
main.c:8:11: error: pasting "1" and "(" does not give a valid preprocessing token
PASTE(1, (1+3)/4);
^
main.c:1:23: note: in definition of macro 'PASTE__'
^
main.c:3:21: note: in expansion of macro 'PASTE_'
^
main.c:8:5: note: in expansion of macro 'PASTE'
PASTE(1, (1+3)/4);
How to force the preprocessor to resolve the result of this expression before concatenating?
source
share