This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__((cleanup(function)) versus try/finally
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 06 May 2003 19:32:01 -0700
- Subject: Re: __attribute__((cleanup(function)) versus try/finally
- References: <Pine.BSF.4.55.0305061457450.57349@acrux.dbai.tuwien.ac.at><1052245742.2583.315.camel@doubledemon.codesourcery.com> <20030507001131.GI7564@redhat.com>
On Tue, 2003-05-06 at 17:11, Richard Henderson wrote:
> On Tue, May 06, 2003 at 11:29:01AM -0700, Mark Mitchell wrote:
> > I think RTH accepts the attribute solution as well. He would prefer
> > try/finally, as I would prefer no extension, but I think we are both
> > willing to accept the attribute.
>
> To some extent I kind-of like the attribute solution on its own.
> It provides much more structured access to cleanups than the
> arbitrary block of code that __finally allows.
>
> I'm not sure I want to explain to users that jumping out of the
> __finally block (via goto/break/return) will lead to undefined
> results. It's less difficult to explain that using longjmp out
> of a function (under certain conditions) is undefined.
>
> > In fact, that solution delivers maximum performance:
> >
> > (1) C functions do not need to have handler code inserted.
>
> This is false. Handler code gets inserted with the attribute too.
I wasn't talking about the attribute solution in this context.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com