ISO/ IEC JTC1/SC22/WG21 N0771

 
Unhandled exceptions in exit()
X3J16/95-0171
WG21/N0771
 
Francis Glassborow
Association of C & C++ Users
64 Southfield Road
Oxford,  OX4 1PA
United Kingdom
 
 
Abstract: A proposal that terminate() be called if any exception is
unhandled during execution of exit().
 
Description:
I propose that paragraph 5 of 18.3 (lib.support.start.term) be changed
by appending: terminate() is called if control leaves any function
called by exit() because of an unhandled exception.
 
Motivation:
Currently only action for unhandled exceptions thrown by functions
registered by atexit() is detailed.  Destructors (and, indirectly,
functions called by these) are also called by exit().  For completeness
these also should be covered for unhandled exceptions.
 
Discussion:
The only matter for discussion is whether paragraph 3 is any longer
necessary.  As this explicitly lists a difference in behaviour between C
and C++ I believe that it should be left as is.