Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-05-08 06:52:37

On Mon, 5 May 2003 20:12:13 -0700, "Paul Mensonides"
<pmenso57_at_[hidden]> wrote:

>Daniel Frey wrote:
>> Paul Mensonides wrote:
>>> #define BOOST_INVARIANT(expr) \
>>> if (!(expr)) \
>> One possible enhancment:
>> if( expr ); else
>> It prevents problems when the macro is used in other
>> if-else-structures.
>Thanks Daniel, I forgot about that...

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)


Boost list run by bdawes at, gregod at, cpdaniel at, john at