Why exceptions for error handling is so important

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 14:06:31 PST 2015


On Monday, 12 January 2015 at 18:11:03 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 12 January 2015 at 17:57:10 UTC, H. S. Teoh via 
> Digitalmars-d wrote:
>> Yeah, exceptions are supposed to be ... well, *exceptions*, 
>> rather than
>> the norm. :-) If you're using exceptions to do flow control, 
>> you're
>> doing something wrong.
>
> I'm sorry, but this is just a crappy excuse invented to defend 
> C++ EH. It has no merits, except being an excuse for writing 
> exceptionally convoluted code to save performance because real 
> exceptions are slow.
>

No, Exception are a bail out mechanism. It is the, I have no idea 
what to do about this mechanism.

If you put aside performance concerns, exceptions for control 
flow also tend to make many code path implicit and makes for very 
unreadable/unmaintainable code.


More information about the Digitalmars-d mailing list