Article

From:
To:
Pete d'Oronzio
Subject:
Re: Exceptions vs Error codes
Newsgroup:
borland.public.delphi.objectpascal

Re: Exceptions vs Error codes

"Pete d'Oronzio" <✉pdmagic.com> wrote in message
news:3b7d8864$2_1@dnews...
> 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 www.optimalcode.com
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.

Kristofer
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Wed, 09 Oct 2024 15:18:00 UTC
Copyright © 2009-2024
HREF Tools Corp.