This is the mail archive of the 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:

> 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:  Type terminate_handler               [lib.terminate.handler]

3 Default  behavior:   The  implementation's  default  terminate_handler
    calls  abort().  terminate                                    [lib.terminate]

2 Effects:  Calls the  terminate_handler function in effect  immediately
    after  evaluating the  throw-expression (, 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]