This is the mail archive of the gcc-patches@gcc.gnu.org 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++


rth@redhat.com (Richard Henderson)  wrote on 06.11.02 in <20021106191509.GH22066@redhat.com>:

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

As a user, I'd say this is too minimal.

> 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?

Does it *need* to? Could C not simply define an interface which deals in  
opaque values? True, that is not worth much when throwing or catching  
across language boundaries, but it should do enough to make this usable  
from inside C, no?

> 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.

Indicating that the inter-language case does not need to do this part.

> 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.

And that is why this is not useful enough to normal C use.

I've wanted exceptions for C for a long time; this isn't it - neither for  
a C programmer, nor for compiling into C.

MfG Kai


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