Re: Necessity of multi-level error propogation
* Annie Testes:
Tony wrote:
"Annie Testes" <annie.testes@googlemail.com> wrote in message
news:9e161367-21cb-491c-8894-93d3558280dc@r36g2000vbp.googlegroups.com...
Tony wrote:
If only to show how painful error management could be
in the good 'ol days of C :)
That's a silly thing to say or at least a silly assumption (that there are
only 2 alternatives: exceptions and C-techniques).
I wasn't assuming only two alternatives, I was
assuming that someone working on your project would
make comparisons with C.
I don't see that as a rule of thumb anymore since error codes can be
reliably propogated up the stack pretty easily without "jumping and
introducing alternative unwind mechanisms".
Reliability:
One common problem in C, is that programers tend to forget to check
and/or
propagate errors. Since C++ has more functionalities, it can give
some help
that doesn't exist in C.
That's exactly what I said above!
Almost. It's certainly possible to make error-propagation
more reliable than in C, but I don't know whether it can be
made as reliable as exceptions. Mandatory error codes are
a first step, but a programmer may still forget to pass them
to the caller. Which kind of technique would you use to
ensure the error code is transmitted during stack unwinding ?
I'm not sure (I often have problems grokking Tony) but I think perhaps he's
thinking of something like Barton & Nackmann's Fallible, a return value that is
a struct that can be logically "empty", where accessing the carried value in a
logically empty one terminates or invokes some installed error handler or throws
an exception. For an exception free scheme it would have to terminate or invoke
error handler. Essentially that would be /imposed/ checking of return values,
not especially good with respect to code structure or efficiency, but at least
avoiding the problems of return values not being inspected by caller.
If he's thinking of Fallible then pointing that out to James would be sort of
misplaced.
For James is the one who usually argues for using Fallible (when appropriate)...
Cheers & hth.,
- Alf
--
Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!