FAQ 9.03 What happens to objects in stack
They are properly destructed.
Local objects that reside on the stack between the
are properly destructed in stack order; last
FAQ 9.04 What is an exception specification?
For example, in FAQ 2.23, routine
If a function throws an exception other than those listed in the exception specification, the unexpected() function is called, which (by default) calls terminate() , which (by default) calls abort() . See FAQ 26.11 for how to change this default behavior.
In general, exception specifications should be used. One place where they are contraindicated, however, is where bug fixes for very large systems are shipped to customers in small binary pieces that are "patched" into the original binary. This is because exception specifications can unnecessarily increase the number of source files that must be shipped with such a bug fix. However for those systems that ship bug fixes as a complete executable, exception specifications should be used.
FAQ 9.05 What are the disadvantages of using return codes for error handling?
They don't separate exceptional logic from normal logic as well as exceptions do, they impose avoidable overhead, and they can't be used in constructors.
Return codes are a nice-guy approach; they allow the caller to do something when an error occurs but they don't require the caller to do anything or even notice that the error has occurred.
Return codes require an explicit
-check after every function call. This
Since testing for return codes requires a conditional branch in the normal execution
Return codes can't be returned from constructors. Fortunately constructors can (and should) throw exceptions. So using return codes with constructors can be disastrous since return codes allow errors to