This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [basic-improvements] try/finally support for c/c++ - more tests
- From: Mike Stump <mrs at apple dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Fergus Henderson <fjh at cs dot mu dot oz dot au>, Jakub Jelinek <jakub at redhat dot com>, Geoff Keating <geoffk at geoffk dot org>, Richard Henderson <rth at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "jason at redhat dot com" <jason at redhat dot com>
- Date: Thu, 7 Nov 2002 10:02:33 -0800
- Subject: Re: [basic-improvements] try/finally support for c/c++ - more tests
On Thursday, November 7, 2002, at 08:55 AM, Aldy Hernandez wrote:
But I would like the support for exception handling to include support
for throwing and catching exceptions, not just try/finally. The
current
proposal seems too limited to be useful for much else than glibc,
IMHO.
How are you going to handle catching exceptions, given that we have no
way to recognize certain types in C (templates, classes, etc)? See
rth's post about catching exceptions in C.
This is easy. You conform to the C++ rtti system. Another way to view
that, is as the definition of the language independent runtime type
information. Once you do that, you can catch and throw any C++
compatible type. There are many in gcc, for example, int. Another
example:
struct exception {
int why;
char *description;
};
the possibilities are endless. The fact there might exist an example
of a type that doesn't work in C land isn't that interesting. If we
add the ability to throw and catch to C, we should of course just do it
correctly, the first time.