On Mon, 5 May 2003 20:12:13 -0700, "Paul Mensonides"
<[EMAIL PROTECTED]> 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)


Genny.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to