
1 Mar
2014
1 Mar
'14
12:43 a.m.
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3877.pdf
Assertion macros taking a level (BOOST_ASSERTL, BOOST_ASSERTL_MSG) controlled by, f.ex. BOOST_ASSERT_LEVEL (0 - opt, 1 - debug, 2 - safe) would be a relatively straightforward addition.
The N3877 approach of supplying three separate macros, one per level, has one advantage though - it doesn't generate "condition is always true/false" warnings. Assume for instance that BOOST_ASSERTL(expr, level) is ((level) <= BOOST_ASSERT_LEVEL? BOOST_ASSERT(expr): (void)0) Here level <= BOOST_ASSERT_LEVEL will almost always be a constant expression, hence warnings.