|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-07-07 21:49:37
> I may be misunderstanding. You'd get unexpected if whoever intercepted it
> (the outermost safety net, at the least) didn't know what to do with it.
> Are you saying that an undecorated member function will terminate rather
> than throw, if something inside it does unexpectedly throw? I didn't think
> it worked that way. I understood it to mean that terminate was invoked if
> either main() failed to catch the exception, the default unexpected handler
> was invoked, or a DTOR invoked by an exception threw. I don't see that any
> of the three would apply in the situation we're talking about. What am I
> missing?
A _decorated_ function will call unexpected (which usually results in
terminate) rather than propagate an exception thrown by a function which it
calls. That is how it honors the contract of its exception-specification.
This mechanism costs something in time and/or space unless _both_ of the
following conditions hold:
1. The compiler can prove that none of the functions which the decorated
function calls can throw an exception
2. The compiler actually implements the optimization which makes use of the
proof in step 1.
This is the rationale:
It is seldom that a compiler can make the above proof.
Very few compilers implement the aforementioned optimization.
-Dave
------------------------------------------------------------------------
eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk