Reputation: 15644
Consider the snippet:
#define CAT(a, b) a##b #define M_0 CAT(x, y) #define M(a) CAT(M_, a)() M(0); #define N_0() CAT(x, y) #define N(a) CAT(N_, a)() N(0);
To me both definitions of M(a)
and N(a)
look identical.
However, cpp
of GCC 4.6.1 expands this to:
CAT(x, y)(); xy;
Why?
Upvotes: 1
Views: 93
Reputation: 104090
#define M_0 CAT(x, y)
#define N_0() CAT(x, y)
M_0
is a simple text replacement. N_0
is a macro function that, when being evaluated, evaluates any other macro functions as necessary.
Upvotes: 5