Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-08-14 12:32:23


----- Original Message -----
From: "Rozental, Gennadiy" <Gennadiy_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, August 14, 2002 1:26 PM
Subject: RE: [boost] Boost.Test progress

> > * !!(predicate) fix as discussed
> >From discussiton it seems that we have 2 solutions
>
> ( (predicate) ? true : false )
> !!(predicate)
>
> I tend to prefer first, since it does check for boolean conversion.
>
> May be something like
> ((bool)(predicate))
>
> would work also?
>
AFAICT, the reason why not all of the above idioms would equally work is
that they might not trigger the exact test that is intended.
It seems to me that, if for a given test, not any boolean expression is
equally valid, then the test itself should apply the necessary expression.
Using !!, as Peter pointed out, would clearly apply the wrong test, but
because the test intended to use the implicit boolean conversion.
Using ?, which is admitely more generally applicable than !!, might, at
least potentially, also apply the wrong test.

Therefore, I think we could leave the macro as it originally was and change
every usage of it where *there is* an implicit conversion which *do causes*
ambiguity. This is the route taken by Peter Dimov.

In any event, it seems to me that '?' is more appropriate for the macro.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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