Making Errors errors

Timon Gehr timon.gehr at gmx.ch
Sat Jan 30 01:06:56 UTC 2021


On 29.01.21 15:23, Paul Backus wrote:
> On Friday, 29 January 2021 at 14:19:02 UTC, sighoya wrote:
>> On Friday, 29 January 2021 at 00:39:08 UTC, Paul Backus wrote:
>>> If out-of-bounds array access is defined by the language spec as an 
>>> unrecoverable error, an optimizing compiler is allowed to assume that 
>>> no program ever recovers from it, and potentially re-order code based 
>>> on that assumption. So you cannot actually be sure that "the code 
>>> following after the random access wouldn't be executed."
>>
>>
>> Okay, if out-of-bound exceptions cause UB, then we can neither abort 
>> the program entirely because UB now belongs to our semantic or the 
>> compiler have to completely reject any way of UB at compile time.
> 
> "Unrecoverable error" does not mean the same thing as UB.

Why is that an useful thing to mandate on the language level? I can 
always choose to terminate the process if I actually think nothing 
useful remains to be done after hitting some condition. Even if the 
error is not recoverable, I might have something to say about how I want 
the program to not recover.

The problem that needs to be solved is that you can catch errors and 
errors can be thrown from nothrow functions, and Walter does not want to 
allow exceptional control flow out of nothrow functions, as that defeats 
one of the reasons why that feature exists in the first place.


More information about the Digitalmars-d mailing list