Topic: unexpected() semantics
Author: "Bradd W. Szonye" <bradds@ix.netcom.com>
Date: 1996/05/07 Raw View
I three questions regarding the semantics of exeptions thrown from within
an unexpected() handler.
A handler installed for the unexpected() function, called when an
exception does not match a function's exception-specification, is allowed
to throw or rethrow an exception.
Q1: What is the point of allowing the handler to rethrow the exception? I
assume that "rethrow" refers to the syntax "throw;" with no argument. The
exception has already failed the exception-specification; why allow a
rethrow?
Q2: Is the unexpected-handler allowed to call other functions, and if so
does the exception mechanism check exception-specifications for the
handling functions? In other words, if the unexpected-handler is:
void handle_unexpected() throw(foo);
and the function throws an exception "bar," incompatible with foo, what
happens? Does the mechanism ignore the throw-spec, call unexpected()
again, or simply terminate()?
Q3: Does the EH mechanism unwind the stack within the unexpected-handler
(and functions it calls, if applicable)? If so, when does this unwinding
occur--at the start of the stack unwind, just before the function that
caused the unexpected() call, immediately, never?
(Note to moderators: I originally posted a message similar to this one on
Friday, May 3. As of the end of the day, Monday, May 6, it has not
appeared. My apologies if I am too quick to follow up.)
--
Bradd W. Szonye (bradds@ix.netcom.com), Doubleplus Corporation
"To chill or to pop a cap in my dome, whoomp, there it is."
-- Hamlet, Prince of Denmark
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]