exceptions vs error codes

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 10 14:31:57 PDT 2016


On Sun, 10 Jul 2016 16:57:49 +0000, ketmar wrote:

> On Sunday, 10 July 2016 at 16:47:31 UTC, Chris Wright wrote:
>> You do need a try/catch in every annotated function to catch runtime
>> exceptions like OutOfMemoryError.
> 
> as a side note: it is even not guaranteed that one *can* catch Error.
> and it is plainly wrong to try to continue execution after that, as
> program is in undefined state.

Array bounds errors, then. For associative arrays, that's a runtime 
method invocation. We'd have to implement every runtime method twice, or 
eliminate precompiled libraries, or accept that @throwAsReturnValue 
requires every function to have a hidden try/catch.


More information about the Digitalmars-d mailing list