Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-13 14:43:52


On Mon, 13 Jan 2003 07:48:24 +0100, Terje Slettebø
<tslettebo_at_[hidden]> wrote:

>No, I don't think so. The previous sentence says: "The parameter list (void)
>is equivalent to the empty parameter list." Then it follows with what is the
>rule, except for this special case.

The problem is the expression "except for this special case". The
above is not a special case of parameter with void type.

> IOW, it's not a parameter type in the
>special case, and it's not otherwise, either.

Exactly.

>How would you propose to clarify it?

Since you asked, I would have added the special case to the grammar,
where one can unambiguously specify whether void is intended literally
or not. Example:

parameter-declaration-clause:
  parameter-declaration-listopt ...opt
  parameter-declaration-list , ...
  empty-parameter-list-specifier

empty-parameter-list-specifier:

   void

Then, since I care clarity (:-)) I would have written:

A parameter-declaration-clause consisting of the
empty-parameter-list-specifier is equivalent to the empty parameter
list. [Note: by grammar, the empty-parameter-list-specifier can only
be (at translation phase 7) the keyword "void" and not e.g. a type-id
of type void]

[...]
>> template <typename T1, typename T2, typename T3>
>> int f(T1 t1, T2 t2, T3 t3);
>>
>>
>>becomes a generator of variadic functions with a fixed maximum number
>>of arguments.
>
>Really? How would you impleent that?

Yup. Forget it, this was just a result of somnolence. In practice,
while sleeping at the keyboard, it occurred to me the wonderful idea
that if you allow

   f (T);

with T=void than you have a variadic function with zero or one
arguments. Hence the "generalization"...

Genny.


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