On Mon, Oct 27, 2008 at 03:19:42PM +0100, Jean-Marc Lasgouttes wrote:
> 
> While looking at assertion code (the new one with a fallback), I notice
> that when assertions are disabled, they are nevertheless all evaluated:
> 
> #define LASSERT(expr, escape) \
>       if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); escape; }
> #endif
> 
> This means that the old style asserts like LASSERT(foo, /**/) will
> _always_ generate and execute doe even when assertions are diabled.
> Isn't this contrary to the very intent of asserts?
> We have 593 assertions in the code, and only 38 of them use the new
> style.
> 
> Andre, was there a reason for doing what you did (like avoid recompiling
> everything when the setting is changed)?
> 
> I think a new macro should be introduced for the two-parameter version.

The idea was to replace /**/ by something sensible in order to avoid the
upcoming crash and notify the user about instead of using BOOST_ASSERT in
the implementation.

Of course this is somewhat different from the old "crash early and
often" approach to customer satisfaction that's typically achieved by
removing asserts from a "release" version...

Andre'

Reply via email to