This is the mail archive of the gcc@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]
Other format: [Raw text]

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


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