Noticed this behavior, which is probably undesirable. Hopefully this gets to
the right people before ship time :)

#define BAR(a,b,c) ((a)+(b)+(c))
#define FOO(x,...) BAR(x,__VA_ARGS__)
FOO(1,2,3)

This should parse, but it doesn't. Preprocessor complains about there not
being enough arguments to BAR. This example works in GCC and other
conformant compilers (which also support named variadics, in the form
#define BLAH(x,name...) printf(x,name)

--chris

Re: variadic macros in vs8 beta2 by Carl

Carl
Mon Apr 18 23:22:29 CDT 2005

Christien Rioux wrote:
> Noticed this behavior, which is probably undesirable. Hopefully this
> gets to the right people before ship time :)
>
> #define BAR(a,b,c) ((a)+(b)+(c))
> #define FOO(x,...) BAR(x,__VA_ARGS__)
> FOO(1,2,3)
>
> This should parse, but it doesn't. Preprocessor complains about there
> not being enough arguments to BAR. This example works in GCC and other
> conformant compilers (which also support named variadics, in the form
> #define BLAH(x,name...) printf(x,name)

Variadic macros are a C99 feature and are not supported by VC++ (any
version).

Variadic macros are not part of any revisions of the C++ standard.

-cd