Re: [boost] BOOST_ASSERT and __assume on MSVC
by Rob Stewart other posts by this author
Sep 19 2005 10:52AM messages near this date
Re: [boost] Scons users?
|
Re: [boost] BOOST_ASSERT and __assume on MSVC
SOURCE From: "Marcin Kalicinski" <kalita@[...].pl>
>
> I think we should rather base on NDEBUG macro, the same that determines the
> behavior of assert. The whole change then boils down to adding these 6 lines
> at the end of assert.hpp:
>
> #include <boost/config.hpp>
> #if defined(BOOST_MSVC) && defined(NDEBUG)
> # define BOOST_ASSUME(e) { BOOST_ASSERT(e); if (e); else __assume(0); }
Interesting. I'd have thought that calling __assume(0) was
useless, but it tells the optimizer that the else clause won't
occur. I wonder if that will work at all or as well as
BOOST_ASSERT(e); __assume(e);.
There's a real problem with your solution, however: you evaluate
the expression twice. Won't the simpler, more direct form work?
--
Rob Stewart stewart@[...].com
Software Engineer http://www.sig.com
Susquehanna International Group, LLP using std::disclaimer;
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Rob Stewart
Rob Stewart
Dave Harris
|