Topic: about exception of standard


Author: do-not-spam-benh@bwsint.com (Ben Hutchings)
Date: Thu, 22 Apr 2004 17:26:50 +0000 (UTC)
Raw View
"chenchang" wrote:
> In 15.5.1.2:
> "In such cases (Described in 15.5.1.1),
>  void  terminate();
>  is called(18.6.3). In the situation where no matching handler is found, it
> is implementation-defined whether or not the stack is unwound before
> terminate() is called." ----- why?

An unhandled exception indicates a bug, so it is useful to get a dump
of the program state at the point at which the unhandled exception is
thrown.  So some implementations call terminate() immediately, which
will typically generate such a dump.

However, simple exception-handling implementations based on setjmp and
longjmp cannot search for a matching handler without unwinding as they
go, so by the time such an implementation determines that an exception
will not be handled it has already unwound the stack.

The standard committee chose not to disallow either of these
implementation techniques.

---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: baibaichen@sohu.com ("chenchang")
Date: Tue, 20 Apr 2004 17:42:43 +0000 (UTC)
Raw View
In 15.5.1.2:
"In such cases (Described in 15.5.1.1),
 void  terminate();
 is called(18.6.3). In the situation where no matching handler is found, it
is implementation-defined whether or not the stack is unwound before
terminate() is called." ----- why?



---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]