Boost logo

Boost :

From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2005-09-21 07:48:22

>> What is the next step so that we can move forward towards adding
>> macro to assert.hpp header?
> Why is this not just the release configuration of BOOST_ASSERT?

That was the original idea but it was noted that it may break existing code
(see excerpt below). IMHO it would be better to have BOOST_ASSERT expand to
__assume, but it's just my opinion. Alternatively, we can make BOOST_ASSERT
expand by default to __assume and add a macro, e.g. BOOST_ASSERT_NO_ASSUME,
which prevents the expansion (to be used by these extremely rare cases where
__assume breaks anything).

== excerpt from original discussion ===

It looks to me as though this risks changing the semantics of BOOST_ASSERT
in a way which might break existing code.

As I read the documentation, currently code like:

    if (!p) {
        BOOST_ASSERT( false );

is supported and meaningful. If BOOST_DISABLE_ASSERTS is true, the macro
does nothing and the return statement is executed when p is 0. If we
change the macro to instead expand to __assume, then the compiler will
probably omit both return and the check against zero. The documented
behaviour of the code will change.

== excerpt ends ===


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