From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2005-09-21 18:19:38


On 9/21/05, Peter Dimov <pdimov_at_[hidden]> wrote:
>
> Excuse me for my jumping late into the thread, but what are the situations
> where one would want to use a BOOST_ASSERT with __assume instead of assert?
>

__assume on MSVC passes hints to the compiler for optimization, it
assumes the expression is always true. So that a function like this:

int f(int x)
{
  __assume(x == 0)
  return x;
}

is optimized by the compiler and just returns 0, without checking for x.
It really seems an interesting opportunity for using already
assertions for optimizations.
The original thread is "BOOST_ASSERT and __assume on MSVC"

--
   Felipe Magno de Almeida
Developer from synergy and Computer Science student from State
University of Campinas(UNICAMP).
Unicamp: http://www.ic.unicamp.br
Synergy: http://www.synergy.com.br
"There is no dark side of the moon really. Matter of fact it's all dark."