Boost logo

Boost :

Subject: Re: [boost] suggestion on assertion macros
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2010-03-12 16:40:30


On Fri, Mar 12, 2010 at 11:59 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> DE wrote:
>>
>> on 12.03.2010 at 20:34
>>  Steven Watanabe wrote :
>>
>>>
>>> If this isn't completely optimized away, and you actually
>>> care, you should get a better compiler.
>>>
>>
>> is that your own motto or the boost one?
>> my point is: it's not always possible to do that
>>
>
> In this case, I'm perfectly serious.  This is such a trivial compiler
> optimization, that if it matters and the compiler doesn't do it,
> you probably have much worse problems.

+1, this is similar to the recommendation to use if(debug) instead of
#ifdef _DEBUG, where debug is defined as something like:

static bool const debug=true; //or false

You can safely trust your compiler to optimize the if away, or if not
you shouldn't care about it (or else you have much bigger problems.)

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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