How to make invariant switchable

Max Samukha outer at space.com
Thu Jun 18 06:46:37 PDT 2009


On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin"
<2korden at gmail.com> wrote:

>On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu <quian.xu at stud.tu-ilmenau.de>  
>wrote:
>
>> Denis Koroskin wrote:
>>>
>>> No, they wont.
>>
>> Is there any reason for that?
>
>I dont know. I'd prefer to write
>
>> debug assert(foo == bar, "foo must be equal to bar");
>
>if I'd like to turn them off in release mode.

'debug' is not necessary in most cases because asserts are removed
from release builds unless the assert condition is known to be false
at compile time, in which case a hlt instruction is generated for the
assert in release mode.



More information about the Digitalmars-d mailing list