|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-09-21 08:58:17
Marcin Kalicinski <kalita <at> poczta.onet.pl> writes:
>
> >> What is the next step so that we can move forward towards adding
> >> BOOST_ASSUME
> >> 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).
>
> As I read the documentation, currently code like:
>
> if (!p) {
> BOOST_ASSERT( false );
> return;
> }
>
> 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.
I don't get it. If you put BOOST_ASSERT( false ) anywhere, then you
effectively say "never exceute this code". Otherwise there is an error
in the assertion itself.
So I don't see how it can break anything.
(The effect of removing an assertion must not be any in a correct program).
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk