The following (test with gcc -E blah.c
):
#define UNUSED(type) type UNUSED_ ## __COUNTER__
UNUSED(char const *)
UNUSED(int)
Generates:
char const * UNUSED__COUNTER__
int UNUSED__COUNTER__
I'm expecting:
char const * UNUSED0
int UNUSED1
I've tried calling another macro, wrapping the arguments in brackets to no avail.
If I don't paste the tokens it seems to work fine.
The documentation specifically mentions the use of __COUNTER__
in token pasting.
What am I doing wrong?