Boost logo

Boost :

Subject: Re: [boost] Alternative implementation for BOOST_PP_VARIADIC_SIZE
From: Jens Gustedt (jens.gustedt_at_[hidden])
Date: 2011-11-14 14:13:17


Paul Mensonides <pmenso57 <at> comcast.net> writes:

> You cannot detect emptiness in the general case
> (even excluding
> pathological input such as unbalanced parentheses). This is simply a
> fact.

could you please give us some arguments for such a strong statement?

P99_IS_EMPTY does at least pretty well, and contrary to Edward Diener's false
assertion somewhere in this thread, it does well with function like macros

> You can attack the problem in a variety of different ways, but all
> of them have limitations that restrict the domain on input.

really I would like to see some meat to that claim

> Regardless, the scenario here is fundamentally wrong-headed. A macro
> argument may be empty, but that does not change the number of arguments.
> E.g.
>
> #define A(...)
>
> A() // one argument (*not* zero arguments)
> B(,) // two arguments
> C(,,) // three arguments

I completely agree with that part. In P99 I use that in particular to provide
default arguments for functions, and there it is important to have A() detect
that this is an empty argument and to produce the default.

(Default arguments with macros is probably not an issue for boost, since this is
for C++ which has default arguments in the core language. P99 is for C99 which
hasn't)

> Moreover:
>
> A( ) // one argument containing a space
>
> The only to have a function-like macro that takes zero arguments is to
> define the macro as nullary.

I didn't capture what you try to say, here.

Jens


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk