Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-05-05 22:14:39


John Torjo wrote:
> and of course....
>
>> #define BOOST_INVARIANT(expr) \
>> if (!(expr)) \
>> boost::invariant(), \
>> std::clog << "invariant failure: " #expr, \
>> boost::BOOST_INVARIANT_A \
>> /**/
>>
>
> Probably this should be
>
> #define BOOST_INVARIANT(expr) \
> if (!!(expr)); \
> else \
> ...
>
> so that this case will work as expected:
>
> if (condition)
> BOOST_INVARIANT(....) do_something();
> else
> do_something_else();

Yes, but you'd still need to put a comma after BOOST_INVARIANT(...):

if (condition)
    BOOST_INVARIANT(...), do_something();
else
    do_something_else();
}

Of course, that would only "do_something()" immediately before the program
terminates.

Regards,
Paul Mensonides


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