[basic-improvements] try/finally support for c/c++

Richard Henderson rth@redhat.com
Wed Nov 6 11:15:00 GMT 2002


On Wed, Nov 06, 2002 at 09:12:15AM -0800, Matt Austern wrote:
> There are an awful lot of ways in which a language can
> support exceptions, after all: why this way instead of one of all
> the others?

In my opinion, this is the most minimal way in which exceptions
can be supported in a language.

The worst problem we have with generic exception handling is the
problem of type correspondence across language boundaries.  This
is of course related to the type of the exception object.  If we
added the ability to throw or catch exceptions in C, the average
user would expect the "right" thing to happen with mixed C and C++
code.  This without any clear description of what the "right"
thing is.  How, for example can C even talk about a template type?

Of course, we have the same problem with mixing Ada <-> C++, and
C++ -> Java (note that Java -> C++ is handled via gcj's CNI), but
as yet no one has either complained or attempted to address the
issue.

With this extension, we have no facilities either for throwing or
catching exceptions; only the running of a bit of code while an
exception propagates through the call chain.  Thus we are able to
avoid all issues related to the type of the exception object.


r~



More information about the Gcc-patches mailing list