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: Mark Mitchell <mark at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Aldy Hernandez <aldyh at redhat dot com>
- Cc: "rth at redhat dot com" <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: Wed, 06 Nov 2002 15:32:20 -0800
- Subject: Re: [basic-improvements] try/finally support for c/c++ - more tests
--On Wednesday, November 06, 2002 12:43:04 PM -0500 Jakub Jelinek
<jakub@redhat.com> wrote:
Hi!
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
do:
try { X } finally { Y }
can always be replaced with either of:
(1) try { X } catch (...) { Y; throw; } Y;
or:
(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 mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com