This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Minor exception bug with unexpected


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]