Why exceptions for error handling is so important

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 14:17:00 PST 2015


On 1/12/2015 1:46 PM, Martin Nowak wrote:
>> There's another downside to returning two values - extra code is generated,
>> and it consumes another register. It allocates very scarce resources to rare
>> cases - not a recipe for high performance.
>
> To defend that argument we'd first have to fix our own codegen.
> https://issues.dlang.org/show_bug.cgi?id=12442

That issue has nothing to do with exception handling vs error codes.


> It doesn't really consume the register, because the error value is only needed
> directly after the call for a possible early return. But of course returning
> tuples can be less efficient.

Yes, it does. Returning an int in EAX now becomes returning a pair [EAX,EDX].



More information about the Digitalmars-d mailing list