|
Boost : |
Subject: Re: [boost] [assert] static_assert envy
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-01-18 12:20:08
AMDG
On 1/18/2011 9:06 AM, Thorsten Ottosen wrote:
> Den 18-01-2011 16:39, Stewart, Robert skrev:
>
>> Perhaps you mean that condition can be used to suppress certain
>> assertions (and not others) without, itself, appearing in the
>> assertion message? I've never done that, so the value is low for me,
>> but perhaps there are good use cases I've overlooked.
>>
>> If you mean something else entirely, please clarify.
>
> It's to avoid writing
>
> BOOST_ASSERT( !foo() || assertion )
>
> which in priciple is identical to
>
> if( foo() )
> BOOST_ASSERT( assertion )
>
> but which is not guaranteed to be removed by the compiler, whereas
>
> BOOST_ASSERT_IF( foo(), assertion )
>
What exactly is wrong with
BOOST_ASSERT( !foo() || assertion )
or
BOOST_ASSERT( foo() ? assertion : true )
IMHO, the last thing we need is lots of
minor variations that don't add any
real utility.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk