Re: Exception specifications unfortunate, and what about their future?
on Wed Dec 17 2008, Eugene Gershnik <gershnik-AT-gmail.com> wrote:
On Dec 15, 1:12 pm, David Abrahams <d...@boostpro.com> wrote:
on Sun Dec 14 2008, DeMarcus <demarcus-AT-hotmail.com> wrote:
Test: have you ever encountered a serious bug that made you say, "if
only I had statically-checked exception specifications, this would've
been avoided?" If so, I'd like to hear about it.
Yes. About two weeks ago I was called to help with a bug in a code I
wrote about a year ago. On some customer sites an always-on server
would mysteriously stop authenticating users with an unhelpful error
log message. Turned out that on these particular sites certain network
condition, never encountered by QA, triggered an exception that wasn't
handled until the very high level handler. This level was too far
removed from the operation details and could only do generic handling
which was log and stop further processing. The crucial part is that
the exception was of a particular type that would have been obvious in
Java and handled appropriately (re-establish the connection) in the
lower level code.
Are you describing a sort of failure that shouldn't be reported with
exceptions in the first place, i.e. a condition that must be responded
to very close to the immediate caller of the reporting function?
I would like to propose an opposite test to anybody who wrote
significant amounts of Java code. Had you ever encountered a situation
where you saw a compiler error due to mismatched ES and had a moment
of "Ah! I better handle this here rather than let it propagate"?
Also a good question.
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]