assume, assert, enforce, @safe
Tobias Pankrath via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 31 01:27:09 PDT 2014
>>
>> In terms of what they practically do, they have *nothing* in
>> common, their
>> functions are entirely orthogonal.
>
> They are inextricably entangled. Consider:
>
> if (x == 0) abort(); // essentially what assert(x) does
> ... at this point, the optimizer knows, beyond doubt, that
> x!=0 ...
> if (x) // optimizer can remove this check
> ...
As far as I unterstand, this would be the behaviour without
-release. With -release the code becomes
if(x)
...
and the optimizer cannot remove the (second) check. Or am I
missing something?
More information about the Digitalmars-d
mailing list