Boost logo

Boost :

From: John Torjo (john_at_[hidden])
Date: 2003-05-08 07:06:02


>
> That's right. But if this will ever get into boost maybe we'll better
> use the classical do-while(0). Borland warns on if(false), and
> assert(false) is quite common, for instance, in the default case of
> switch statements. BOOST_INVARIANT(false) could be used similarly
> (Though, depending on the people who would speak in the formal review,
> we could choose to have a separate macro for 'assert always'-like
> cases, with no condition argument)
>

Unfortunately, we can't use the do-while(0) idiom, since we don't know when
while(0) will be ;-)

Example:
BOOST_ASSERT(i != j)(i)(j);

or

BOOST_ASSERT(i > 1000)(i);

note: see the 'smart assert' thread, where we discuss details about the
interface/ implementation of the smart assert (BOOST_ASSERT)

Best,
John


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