This is the mail archive of the 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: [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.

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