assume, assert, enforce, @safe

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 02:11:32 PDT 2014


On 7/31/2014 1:27 AM, Tobias Pankrath wrote:
>>>
>>> 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?

My intention is that the runtime check would be omitted, but the information 
would still be fed to the optimizer. This is not currently implemented.


More information about the Digitalmars-d mailing list