This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Exceptions, C, and Gcc
- From: Kevin Atkinson <kevina at gnu dot org>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc at gnu dot org
- Date: Fri, 07 Mar 2003 21:17:34 -0500 (EST)
- Subject: Re: Exceptions, C, and Gcc
On Fri, 7 Mar 2003, Zack Weinberg wrote:
> Kevin Atkinson <kevin at atkinson dot dhs dot org> writes:
>
> > 1) Is it or will it ever be safe to throw exceptions when a C function
> > calls a C++ via a callback. Especially when use of a longjmp would be
> > safe. (Ie the program will remain in a consistent state even if the
> > handler functions does not return). Since C does not have destructors I
> > can't think of anything that needs to be done other than popping the stack.
>
> Yes, but you must compile all of the C code with -fexceptions; this is
> off by default to save space.
I know IF compiled with -fexceptions. But my question is WHY is that
necessary. What exactly needs to happen in a function for an exception to
pass through a C function. Can't it just pop the stack as would happen in
a longjmp. Sorry for my ignorance.
--
http://kevin.atkinson.dhs.org