
In-Reply-To: <200509211851.j8LIp8VY019052@shannonhoon.balstatdev.susq.com> stewart@sig.com (Rob Stewart) wrote (abridged):
That misses what BOOST_ASSUME should do when BOOST_DISABLE_ASSERTS is not defined. With BOOST_ASSERT enabled, BOOST_ASSUME should call both BOOST_ASSERT and __assume():
Why? Consider the sequence: BOOST_ASSERT(e); __assume(e) Suppose (e) is true. Then BOOST_ASSERT does nothing, so why invoke it? If (e) is false, then the __assume tells us the sequence won't be executed at all, and both it and the BOOST_ASSERT can be optimised away. Whatever it is you want BOOST_ASSERT to do, you can't rely on it happening. It will depend on how clever the optimiser is, which will vary from platform to platform. In addition, it evaluates (e) twice. That's bad practice for a macro. It would be acceptable if it were necessary (and we certainly hope (e) has no side effects and that its value doesn't change between the assert and the assume) but here there is no need for it. -- Dave Harris, Nottingham, UK.