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: Use of -fno-exceptions



> > The exceptions support is needed to do a cleanup.  When an exception
> > is thrown, the stack gets popped one frame at a time and destructors
> > are called, up to the point where the exception is caught.  For this
> > to work properly, every possible call site that could be involved
> > would need to be compiled with exceptions enabled.  You may be able
> > to make a mixed environment work, but it will be tricky and perhaps
> > unstable.
> 
> Is that strictly true?  My understanding is that one could use
> sjlj-exceptions and throw over any call frame, compiled with -fexceptions
> or not, because setjmp/longjmp processing doesn't require explicit unwind
> info.

For a call frame where a destructor must be called, even with sjlj you
need -fexceptions to get that destructor called.  Otherwise there will
be a memory leak and possibly some resource that should be freed won't
be (like a lock for a critical region, if managed with a constructor/
destructor pair).


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