Subject: Re: [boost] Need for BOOST_PP_VARIADIC_POP_FRONT
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-11-12 12:36:18
On 11/10/2011 11:21 AM, Gennadiy Rozental wrote:
> GMan<gmannickg<at> gmail.com> writes:
>>> (with support for zero arguments).
>> If we're talking about C99 variadic macros, then (IIRC) variadic arguments
>> *must* contain at least one element.
> Do you mean according to standard? Can you provide reference
In the Ansi C 1999 spec 6.10.3 paragraph 12 reads:
"If there is a ... in the identifier-list in the macro definition, then
the trailing arguments, including any separating comma preprocessing
tokens, are merged to form a single item: the variable arguments. The
number of arguments so combined is such that, following merger, the
number of arguments is one more than the number of parameters in the
macro definition (excluding the ...)."
If we have a variadic macro:
#define VAR_MACRO(...) __VA_ARGS__
and we invoke it as:
The number of parameters in the macro definition ( excluding the ... )
is 0, therefore the number of arguments must be 1, as being one more
than the parameters. But clearly the number of arguments is 0.