I'd like to use a macro like the following:
#define x(...) y(a,##__VA_ARGS__,b)
To expand like so:
x(); -> y(a,b);
x(1); -> y(a,1,b);
With -std=gnu99
, it works perfectly.
With -std=c99
however, it looks like this:
x(); -> y(a,,b);
x(1); -> y(a,1,b);
The ##
is making no difference – it's not swallowing the comma.
In other usages under C99, e.g. #define x(a,...) y(a,##__VA_ARGS__)
, comma-swallowing works fine.
What can I do, if anything, to get the desired comma-swallowing behaviour under clang's -std=c99
, either with the GNU extension ##
or by some other method?