[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libguile with C++ exceptions
From: |
Isaac Kar-Keung To |
Subject: |
Re: libguile with C++ exceptions |
Date: |
25 Mar 2001 22:39:18 +0800 |
User-agent: |
Chaos/1.13.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (i386-debian-linux-gnu) MULE/4.0 (HANANOEN) |
>>>>> "Marius" == Marius Vollmer <address@hidden> writes:
Marius> I don't know. Do C++ exceptions work when no Guile exceptions
Marius> are happening?
No.
Marius> Maybe you need to link libguile with the C++ compiler.
Right, but I wonder whether this is the "right" solution. Frankly I think
it's not. The direct cause of the problem is of course that a C compiler
won't generate the tables required for C++ exception handling. This means
that upon throwing an exception, the exception handling routine will fail to
find an exception table and thus must stop exception handling, sending
itself SIGABRT and dump core.
But the more important semantic problem is that C programs do not expect
exceptions to be thrown. That is, code there is not exception safe, and
there is usually no way to make it exception safe. In particular, some of
the recovery of the libguile exception handler is not done properly if an
exception causes gh_catch to be returned abnormally. Thus it does no good
to catch the exception outside gh_catch: the states of the Guile library is
already corrupted.
The right solution is probably not to throw any exception for any code that
is called by gh_catch() through function pointer.
Regards,
Isaac.
pgpzzPFMDuk6b.pgp
Description: PGP signature