Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-21 13:51:08


From: brangdon_at_[hidden] (Dave Harris)
> In-Reply-To: <dgmfeo$q1v$1_at_[hidden]>
> kalita_at_[hidden] (Marcin Kalicinski) wrote (abridged):
>
> #include <boost/config.hpp>
> #if defined(BOOST_MSVC) && defined(BOOST_DISABLE_ASSERTS)
> # define BOOST_ASSUME(e) __assume(e)
> #else
> # define BOOST_ASSUME(e) BOOST_ASSERT(e)
> #endif

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():

   #include <boost/config.hpp>
   #if defined(BOOST_MSVC)
   # if defined(BOOST_DISABLE_ASSERTS)
   # define BOOST_ASSUME(e) __assume(e)
   # else
   # define BOOST_ASSUME(e) BOOST_ASSERT(e); __assume(e)
   # endif
   #else
   # define BOOST_ASSUME(e) BOOST_ASSERT(e)
   #endif

(I haven't determined whether the definitions will work in all
intended contexts; this can be considered conceptual.)

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk