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:57:31


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

> I am not against having such a macro. I am against any form of treating
> an empty sequence of preprocessing tokens and whitespace separations (or
> one containing only whitespace separations) as a non-element in a data
> structure. "Empty" is a data element just as any other. E.g. () is not a
> nullary tuple, it is a unary tuple, and so on.

At some point you must make such a distinction simply because these
concepts are treated differently between core language and
preprocessor (for both C99 and C++) and even in the preprocessor
itself.

For the core language A() is a call with zero arguments.

For the preprocessor A() is
 - a macro call with one argument, the empty one, if A has been
   defined to receive any argument
 - a macro call with zero arguments if the macro was defined to
   receive no argument

I think any macros that are designated to be used by an "end user"
must mediate between those different views and provide an end result
that reads well for that end user, who I think expects syntax written
as if it where core language.

In P99 I use the IS_EMPTY macro for exactly that, try to accommodate
that supposed expectation.

Jens


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