Why does scope(success) have to use exceptions?
Maxim Fomin
maxim at maxim-fomin.ru
Thu Jan 17 08:05:02 PST 2013
On Thursday, 17 January 2013 at 15:16:07 UTC, Johannes Pfau wrote:
> 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?
DMD should optimize, but I was arguing that in this situation it
should not do this.
More information about the Digitalmars-d
mailing list