simplecpp icon indicating copy to clipboard operation
simplecpp copied to clipboard

Nested macros containing ## do not get expanded properly.

Open tortoisedoc opened this issue 8 years ago • 4 comments

#define GETMYID(a) ((a))+1
#define FIGHT_FOO(c, ...) foo(c, ##__VA_ARGS__)
FIGHT_FOO(1, GETMYID(a));

The gcc -E says:

foo(1, ((a))+1);

And simplecpp says:

foo ( 1 , GETMYID ( a ) ) ;

tortoisedoc avatar Dec 27 '16 12:12 tortoisedoc

For your information.. please always indent all code with 4 spaces. Then github will understand it's code. it will look better and it avoids that code are interpreted as formatting.

danmar avatar Dec 27 '16 21:12 danmar

Thanks, not used to github posting too much :). Apologies for the hassle!

tortoisedoc avatar Dec 28 '16 07:12 tortoisedoc

That seems to be a compiler specific extension to the concatenation operator, see http://en.cppreference.com/w/cpp/preprocessor/replace#.23_and_.23.23_operators

amai2012 avatar Apr 19 '18 21:04 amai2012