tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: C++ exceptions in C [was: Re: CVS commit: src/external/bsd/atf/dist/atf-c++]



On Tue, Jul 06, 2010 at 07:21:27PM +0100, Julio Merino wrote:
> Summarizing: what should happen when a C++ function calls a C function
> that, in turn, calls another C++ function that throws exceptions?  Up
> to where should exceptions propagate?  Intuition tells me that they
> should never reach C land.  (Yeah, no comments on this bizarre
> setup...)

For the record I will repeat what I said on IRC. i386 and amd64 differ
in one important aspect of the default code generation. For amd64
setting up the frame pointer is optional disabled by default. To make it
possible to do debugging, amd64 also has the .eh_frame section in that
case, which makes it possible to unwind the stack. This section is also
used by the C++ stack unwinding code when looking for an exception
handler.

Programs and libraries that mix C/C++ and want exceptions to "correctly"
propagate across C functions have to make sure to compile the C code
with -fexceptions.

Joerg


Home | Main Index | Thread Index | Old Index