Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 11 15:03:47 PDT 2014


On 10/9/2014 9:33 AM, Johannes Pfau wrote:
> A point which hasn't been discussed yet:
>
> Errors and therefore assert can be used in nothrow functions. This is a
> pita for compilers because it now can't do certain optimizations. When
> porting GDC to ARM we started to see problems because of that (can't
> unwind from nothrow functions on ARM, program just aborts). And now we
> therefore have to worsen the codegen for nothrow functions because of
> this.
>
> I think Walter sometimes suggested that it would be valid for a
> compiler to not unwind Errors at all (in release mode), but simply kill
> the program and dump a error message. This would finally allow us to
> optimize nothrow functions.

Currently, Errors can be caught, but intervening finally blocks are not 
necessarily run. The reasons for this are:

1. better code generation

2. since after an Error the program is likely in an unknown state, the less code 
that is run after an Error, the better, because it may make things worse



More information about the Digitalmars-d mailing list