Boost logo

Boost :

From: Simon Buchan (simon_at_[hidden])
Date: 2005-09-14 22:47:40


Marcin Kalicinski wrote:
> Hi All,
>
> Have you considered modifying BOOST_ASSERT to use __assume on MSVC?
>
> Briefly speaking __assume(expr) is a hint for optimizer that 'expr'
> evaluates to nonzero. It can help optimize the code. Standalone use of
> __assume is not recommended because compiler does not check if the
> assumption is correct, and if it isn't the program is ill formed. But it
> fits perfectly in ASSERT macro. This way putting many ASSERTs will not only
> help to verify the code - it will also help the optimizer. Wow!
<snip>
I don't get it, isn't the point of assert that it DOES check them? Or
did you mean something like GCC's __builtin_expect?
http://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fexpect-2279


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