From: John Torjo (john_at_[hidden])
Date: 2003-05-08 01:06:28
> Will the old alternative v_() evaluating parameters just once also
I guess that could also happen. But it would probably uglify and complicate
the syntax. Also, I see three cases here:
This is the simple case, which is already covered (you don't have to type
anything else) - see point 14. (handling simple assertions)
2. BOOST_ASSERT( some_lengthy_function() > 10) ( some_lengthy_function());
Indeed, is kind of lengthy, but this is life :-(
The point is that I could provide the v_ macro as well - it would not be too
complicated. What do others think?
3. BOOST_ASSERT( some_lengthy_function(x, y, z));
This should be something like:
BOOST_ASSERT( some_lengthy_function(x, y, z))(x)(y)(z);
> If not-idempotent function is given as parameter, it may have sideeffects
> (silly contrived example: pool resource allocator which gets exhausted in
> the middle of assert).
I did think (a lot!) about this. But, it's reasonable to assume that
functions/ member functions that are called within an ASSERT should all be
constant, because they won't be called at all in release mode.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk