7 Jun
2013
7 Jun
'13
10:36 a.m.
On Friday 07 June 2013 12:16:49 Krzysztof Czainski wrote:
So should there be a guideline to use the BOOST_ASSERT( expr || !"msg" ) idiom instead of BOOST_ASSERT_MSG, when msg is only a string literal, or how should this problem be addressed?
IMHO, BOOST_ASSERT_MSG should be optimized, and this is possible to do while keeping the current interface. If boost::assertion::detail::assertion_failed_msg is defined to be never inlined, and the checked condition is marked so that it is unlikely to be true, then this would solve the problems I mentioned. This will probably require adding BOOST_NOINLINE and BOOST_LIKELY/BOOST_UNLIKELY macros to Boost.Config though. I can do this a bit later, if noone objects.