If you needed any more evidence that memory safety is the future...

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 25 14:37:15 PST 2017


On Sat, 25 Feb 2017 21:49:43 +0000, Chris Wright wrote:

> On Sat, 25 Feb 2017 22:12:13 +0100, Timon Gehr wrote:
> 
>> On 25.02.2017 15:38, Chris Wright wrote:
>>> On Sat, 25 Feb 2017 13:23:03 +0100, Timon Gehr wrote:
>>>> If 'disable' (as can be reasonably expected) means the compiler will
>>>> behave as if they were never present, then it does not.
>>>
>>> https://dlang.org/dmd-linux.html#switch-release
>>>
>>>
>> This literally says "[...] assertion failures are undefined behaviour".
> 
> ...
> 
> It says it doesn't emit code for assertions.
> 
> Then it says assertion failures are undefined behavior.
> 
> How does that even work?

As far as I can tell, it's worded poorly enough to be incorrect.

The undefined behavior is what happens after the would-be assertion 
failure occurs. The compiler is free to emit code as if the assertion 
passed, or if there is no way for the assertion to pass, it is free to do 
anything it wants.

However, the assertion isn't emitted, so there is no assertion failure. 
That part is defined behavior; it was defined in the preceding sentence.


More information about the Digitalmars-d mailing list