Making Errors errors
sighoya
sighoya at gmail.com
Fri Jan 29 14:19:02 UTC 2021
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.
I'm a fan of banning any occurrence of UB in a language, rather I
prefer things to be implementation defined which is sometimes
just not possible because of OS mystery.
On the other side, it isn't anyway possible to assure the
implementation satisfies the needs of the frontend, e.g. malloc
may not allocate memory at all just print a smiley to console.
From this point we could define any operation as UB, but it
doesn't make that sense...
More information about the Digitalmars-d
mailing list