In article <3b7f9bd0$1_1@dnews>
"Kristofer Skaug" <✉skaug.demon.nl> wrote:
>
> "Barry Kelly" <✉eircom.net> wrote in message
> news:✉4ax.com...
> >
> > I'm afraid I'm the reverse; exceptions *force* you to consider the
> > possibility of errors.
>
> so, isn't that pretty dictatorial?
"OK, in our next framework, we don't really care about errors. If you
want to know if you're headed for la-la land, you're going to have to
ask. We'll happily let you drive off a cliff with all you're customer's
data rather than let you know that something's awry."
> > Error codes are optional; an awful lot of code
> > can be written without regard for the error codes returned, and thus
> > will continue on blithely unaware of error conditions, mucking up
> state,
> > causing instability that isn't detected possibly for days, leading to
> > lots of $$$ loss.
>
> But errors are relative - one program's error can be another program's
> "don't care" (with respect to a generic library service). For example,
> say you call WinAPI functions to read out version info from a set of DLL
> files. If you are merely preparing information for you About box you may
> decide to ignore errors and simply print "Not found" for missing version
> info resources. In a configuration management program this is however
> critical and you may want to raise hell about it.
> I'd hate for those functions to *always* slap me with an exception for it
> though. A low-key error code is fine.
So wrap it in a little try..except that adds an appropriate error
message to the about box. I'd consider that much neater than losing the
richness of the error information and just blankly printing "Not found".
> It all depends on specification.
> So, depending on how you *intend* your code to work, but also depending
> on third party libraries, you may have to do a hell of a lot of exception
> quenching in the low level interfaces.
> If you basically consider that *every* function call in principle can
> fail, and treat the return codes with appropriate respect, you are no
> less safe than with exceptions. I don't need exceptions to remind me that
> code can fail.
You might not.
However, it appears you do simply by the very fact that you notice them.
-- Barry
--
If you're not part of the solution, you're part of the precipitate.
Team JEDI: http://www.delphi-jedi.org
NNQ - Quoting Style in Newsgroup Postings
http://web.infoave.net/~dcalhoun/nnq/nquote.html