Why exceptions for error handling is so important

Matthias Bentrup via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 08:15:32 PST 2015


On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote:
>> On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim 
>> Grøstad wrote:
>>> Does this mean that D will get fast EH?
>>
>>
>> It is fast already...
>
> What makes you say that? Doesn't D still use the standard 
> zero-cost EH that was created for Itanium, where you take the 
> performance hit on unwinding?

The advantage of return code / union type error handling is that 
the exceptional case is as fast as the successful case.

The disadvantage of return code / union type error handling is 
that the successful case is as slow as the exceptional case.

So which method is faster depends on how exceptional your 
exceptions are.


More information about the Digitalmars-d mailing list