Pete d'Oronzio
Re: Exceptions vs Error codes

Re: Exceptions vs Error codes

I think there are two objections to the manner of using exceptions that you
suggest. The first is that exceptions are heavy on cpu usage even when
caught within the same mehtod/function. The second is that it makes for
contorted code where a simple loop would have been both faster, less messy
and more readable.

It's probably worth pointing out that the word "exception" does not really cover expected situations. It's supposed to cover the unexpected which means that for which your program cannot be reasonably expected to cope. A user providing a path to a non-existent file, for example, or an alphanummeric string where a number is required.
FYI: Phrase searches are enclosed in either single or double quotes
Originally created by
Tamarack Associates
Tue, 07 Feb 2023 05:39:07 UTC
Copyright © 2009-2023
HREF Tools Corp.