Why does scope(success) have to use exceptions?

Johannes Pfau nospam at example.com
Thu Jan 17 07:16:05 PST 2013


Am Thu, 17 Jan 2013 13:15:06 +0100
schrieb "Maxim Fomin" <maxim at maxim-fomin.ru>:

> On linux, segfaults can be translated into exceptions using this 
> module 
> (https://github.com/D-Programming-Language/druntime/blob/master/src/etc/linux/memoryerror.d) 
> however I do not know how to use it - I get linker errors.
> 
> On windows null pointer errors are translated into Object.Error 
> (Access Violation) - I do not remember exactly.
> 
> In any case, your void callScope(ref int x) can be blown up by:
> int* ptr; callScope(*ptr); so, exceptions may come when they are 
> not expected.

Uh, does that meany that a D compiler can never optimize by removing
exception handling, even if it can prove that all involved methods are
nothrow and don't throw errors as well?


More information about the Digitalmars-d mailing list