|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-29 13:04:36
> Steven Watanabe wrote:
>
>> template<class T>
>> void use_variable(const T&) {}
>>
>> #if ENABLE_ASSERT
>> #define BOOST_ASSERT(x) normal implementation
>> #else
>> #define BOOST_ASSERT(x) use_variable(x)
>> #endif
>>
>
> Looks good to me :-)
>
> @Peter: You are listed as the author of assert.hpp, do you think
> this could be done? Or will this disable the compilers optimizer,
> so he can do away with the return value?
>
> Roland aka speedsnail
This doesn't seem to do what you want.
BOOST_ASSERT( this_takes_time() ); // breaking change
The introduction of BOOST_VERIFY with a similar implementation would
probably be best.
#if ENABLE_ASSERT
#define BOOST_VERIFY(x) BOOST_ASSERT(x)
#else
#define BOOST_VERIFY(x) ((void)(x))
#endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk