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

On Wed, 6 Nov 2002 10:56:30 -0800, Richard Henderson <> wrote:

> On Wed, Nov 06, 2002 at 09:03:45AM -0500, Jason Merrill wrote:
>> > You probably need to define __finally in terms of destructors
>> > in order for this to work out properly.  E.g. a finally block
>> > is the destructor for an anonymous object of an anonymous type.
>> > Or something.  Perhaps Jason or Mark could help here?
>> The code in the finally block is run on exit from the try block, except
>> that exiting a try block with a corresponding finally block via longjmp or
>> computed goto has undefined behavior.
> Yes, clearly, but how to integrate this statement cleanly with
> the ISO document?  That is why I think we need to piggyback on
> the existing destructor language.

The above is proposed wording.  :)

For destructors, the C++ standard just says (in stmt.dcl)

  with automatic storage duration declared in the block are destroyed on
  exit from the block (_stmt.jump_).

I think trying to word it in terms of a destructor would be too
complicated; it's easier to express cleanups in terms of try/finally.


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