exceptions vs error codes
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 13 11:02:15 PDT 2016
On Wed, 13 Jul 2016 13:50:00 +0000, ketmar wrote:
> https://dlang.org/library/object/throwable.html
>
> "In principle, one should not catch Throwable objects that are not
> derived from Exception, as they represent unrecoverable runtime errors.
> Certain runtime guarantees may fail to hold when these errors are
> thrown, making it unsafe to continue execution after catching them."
So this is two separate things coming together:
1) If the runtime is sufficiently borked, it might be unable to unwind
the stack.
2) If the runtime detects that it is borked, it will throw something
derived from Error.
You could just as well say that *no* runtime function is guaranteed to be
safe to call because the runtime could be in an invalid state without
having detected it. It's merely slightly riskier when an Error has been
thrown.
Specific to stack unwinding, it's pretty isolated from the rest of the
runtime.
More information about the Digitalmars-d
mailing list