Pete d'Oronzio
Re: Exceptions vs Error codes

Re: Exceptions vs Error codes

"Pete d'Oronzio" <‚úČ> wrote in message
> same function as a safety net for a flying trapeze artist?

Nice metaphor <g>

> Does anyone have any hard numbers about added code size,
> execution size or speed?

You may want to sniff around at
I believe Bob Lee has some stuff about exception handling overhead too.

> What if I write a routine that returns an error code.  Someone uses it, but
> doesn't handle the error code because "this is just a quick and dirty
> version".

That's his responsibility. It's not up to you to dictate how he uses your
code. If he chooses to ignore the error code you give him he will have an
incorrect program. He knows that.

> A programmer must explicitly dismiss an exception, while an error code can
> be ignored by default.

Exceptions can be ignored too. The fact that you have a top-level
exception handler which displays a messagebox doesn't mean that you are
*handling* errors, you are just letting them transpire in a certain
default manner. Your application will still go into an unstable state if
you're not lucky, and more errors will follow. I don't see that you gain
a lot with using exceptions in this case.

FYI: Phrase searches are enclosed in either single or double quotes
Originally created by
Tamarack Associates
Tue, 07 Feb 2023 04:09:29 UTC
Copyright © 2009-2023
HREF Tools Corp.