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 Wednesday, November 06, 2002 12:43:04 PM -0500 Jakub Jelinek <> wrote:


On Tue, Nov 05, 2002 at 03:19:02PM -0800, Aldy Hernandez wrote:
As promised.  Here are the try/finally patches for C and C++.
I've been offline for a few days, and am trying to catch up on email,
not to mention the release.  So, I apologize for jumping in late.

But, I do not approve of adding try/finally to C and/or C++ until
and unless ISO adds it.

There is nothing you can do with try/finally in C++ you can't already

 try { X } finally { Y }

can always be replaced with either of:

(1) try { X } catch (...) { Y; throw; } Y;


(2) { struct S { ~S() { Y } } s; X }

depending on your stylistic preference.

These examples show that Richard's point about needing to deal with
unknown exception types is moot; the use of ... already allows you
to avoid knowing the type.

I do not think we should add exception support of any kind to GNU C; use
C++ if you want exceptions.

Please do not check in these patches until we've had a chance to hash
this out more fully.

If we do want to check these patches in, the semantics should be given
in terms of translation to (1) above.

Mark Mitchell      
CodeSourcery, LLC  

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