This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Minor exception bug with unexpected
- To: ak at muc dot de, oliva at dcc dot unicamp dot br
- Subject: Re: Minor exception bug with unexpected
- From: mrs at wrs dot com (Mike Stump)
- Date: Mon, 23 Mar 1998 14:26:25 -0800
- Cc: egcs-bugs at cygnus dot com
> Date: Fri, 20 Mar 1998 07:06:22 +0100
> From: ak@muc.de
> You're right. I didn't notice that __default_terminate() calls abort()
> instead of a cleaner exit(0). My prefered behaviour would be
>
> /* Or the equivalent on the non-unix gcc target, otherwise nothing */
> write(1, "unexpected exception\n", 21);
> exit(1);
> abort() usually causes a core dump which I see as overkill here.
> Comments?
Yes. This is wrong.
Please have a read of the ANSI C++ Standard:
18.6.3.1 Type terminate_handler [lib.terminate.handler]
3 Default behavior: The implementation's default terminate_handler
calls abort().
18.6.3.3 terminate [lib.terminate]
2 Effects: Calls the terminate_handler function in effect immediately
after evaluating the throw-expression (18.6.3.1), if called by the |
implementation, or calls the current terminate_handler function, if |
called by the program.
Also, calling exit isn't the same as calling abort. Check out what
happens with atexit and global destructors.