public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC Feature question
@ 2002-09-27 22:15 Michael Lovett
  2002-09-27 22:45 ` Aldy Hernandez
  2002-09-28  0:20 ` Tim Prince
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Lovett @ 2002-09-27 22:15 UTC (permalink / raw)
  To: gcc

Hiya

Does the current GCC (3.2x) support the try/finally construct?

We are porting apps to UNIX from Windows but so far can't find a compiler with try/finally. It is such a useful, convenient construct it is hard to imagine structured programming without it.

Does anyone know if this is planned for the future if it isn't available now?

Thanks so much!
Michael Lovett

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
  2002-09-27 22:15 GCC Feature question Michael Lovett
@ 2002-09-27 22:45 ` Aldy Hernandez
  2002-10-04 12:26   ` Jason Merrill
  2002-09-28  0:20 ` Tim Prince
  1 sibling, 1 reply; 7+ messages in thread
From: Aldy Hernandez @ 2002-09-27 22:45 UTC (permalink / raw)
  To: Michael Lovett; +Cc: gcc

>>>>> "Michael" == Michael Lovett <mlovett@morpace.com> writes:

 > Hiya
 > Does the current GCC (3.2x) support the try/finally construct?

Before Richard and Uli publicly kick my butt...

That's me.  I was supposed to have done this.  I have it partially
finished.  It's just missing the important bits for passing through
exceptions.

I'll hopefully be finishing this up in the next week or two, but since
we are in code freeze, it won't make it until 3.3.

 > We are porting apps to UNIX from Windows but so far can't find a compiler =
 > with try/finally. It is such a useful, convenient construct it is hard to =
 > imagine structured programming without it.

C or C++?  With C++ you can emulate it with constructors, albeit ugly.

 > Does anyone know if this is planned for the future if it isn't available =
 > now?

Yes it is.  Blame me.

(Mr. Procrastinator) Aldy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
  2002-09-27 22:15 GCC Feature question Michael Lovett
  2002-09-27 22:45 ` Aldy Hernandez
@ 2002-09-28  0:20 ` Tim Prince
  2002-09-28 10:00   ` Aldy Hernandez
  1 sibling, 1 reply; 7+ messages in thread
From: Tim Prince @ 2002-09-28  0:20 UTC (permalink / raw)
  To: Michael Lovett, gcc

On Friday 27 September 2002 19:57, Michael Lovett wrote:
> Hiya
>
> Does the current GCC (3.2x) support the try/finally construct?
>
> We are porting apps to UNIX from Windows but so far can't find a compiler
> with try/finally. It is such a useful, convenient construct it is hard to
> imagine structured programming without it.
>
> Does anyone know if this is planned for the future if it isn't available
> now?
>
> Thanks so much!
> Michael Lovett
To the extent this stuff is supported in the cygwin win32api, you may be able 
to adapt it to reconcile its conflicts with other g++ targets.  You may find 
further information in the cygwin FAQ and, of course source code.  It's 
certainly considered more of a library than a compiler thing.
-- 
Tim Prince

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
  2002-09-28  0:20 ` Tim Prince
@ 2002-09-28 10:00   ` Aldy Hernandez
  0 siblings, 0 replies; 7+ messages in thread
From: Aldy Hernandez @ 2002-09-28 10:00 UTC (permalink / raw)
  To: tprince; +Cc: Michael Lovett, gcc

>>>>> "Tim" == Tim Prince <tprince@computer.org> writes:

 > To the extent this stuff is supported in the cygwin win32api, you may be able 
 > to adapt it to reconcile its conflicts with other g++ targets.  You may find 
 > further information in the cygwin FAQ and, of course source code.  It's 
 > certainly considered more of a library than a compiler thing.

Huh?

How are you going to do this in library code?

while (1) {
        try {
                if (blah)
                        break;
        } finally {
                puts("exiting loop");
        }
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
  2002-09-27 22:45 ` Aldy Hernandez
@ 2002-10-04 12:26   ` Jason Merrill
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Merrill @ 2002-10-04 12:26 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: Michael Lovett, gcc

On 27 Sep 2002 20:42:56 -0700, Aldy Hernandez <aldyh@redhat.com> wrote:

>  > We are porting apps to UNIX from Windows but so far can't find a
>  > compiler with try/finally. It is such a useful, convenient construct
>  > it is hard to imagine structured programming without it.
>
> C or C++?  With C++ you can emulate it with constructors, albeit ugly.

It's not *that* ugly.  For C++ using a destructor encourages you to write
reusable finalization code.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
       [not found] <sd9dae8d.087@farm_groupwise1_srv.morpace-i.com>
@ 2002-10-04 15:20 ` Jason Merrill
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Merrill @ 2002-10-04 15:20 UTC (permalink / raw)
  To: Michael Lovett; +Cc: aldyh, gcc

On Fri, 04 Oct 2002 15:06:41 -0400, "Michael Lovett" <mlovett@morpace.com> wrote:

> Well, sometimes there are things you want to do locally in your code that
> don't necessarily involve object destruction, and you'd like these things
> to happen whether or not an exception was thrown. These are the types of
> things we are anxious for try/finally.

No, they don't necessarily involve object destruction, but they can
certainly be written using a destructor, perhaps for a local class.
Usually they involve cleaning up after initialization code earlier in the
function, in which case writing them as a constructor/destructor pair makes
a lot of sense.

And it's portable C++, which try/finally isn't.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GCC Feature question
@ 2002-10-04 12:52 Michael Lovett
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Lovett @ 2002-10-04 12:52 UTC (permalink / raw)
  To: aldyh, jason; +Cc: gcc

Well, sometimes there are things you want to do locally in your code that don't necessarily involve object destruction, and you'd like these things to happen whether or not an exception was thrown. These are the types of things we are anxious for try/finally.

M

>>> Jason Merrill <jason@redhat.com> 10/01/02 01:30PM >>>
On 27 Sep 2002 20:42:56 -0700, Aldy Hernandez <aldyh@redhat.com> wrote:

>  > We are porting apps to UNIX from Windows but so far can't find a
>  > compiler with try/finally. It is such a useful, convenient construct
>  > it is hard to imagine structured programming without it.
>
> C or C++?  With C++ you can emulate it with constructors, albeit ugly.

It's not *that* ugly.  For C++ using a destructor encourages you to write
reusable finalization code.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-10-04 21:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-27 22:15 GCC Feature question Michael Lovett
2002-09-27 22:45 ` Aldy Hernandez
2002-10-04 12:26   ` Jason Merrill
2002-09-28  0:20 ` Tim Prince
2002-09-28 10:00   ` Aldy Hernandez
2002-10-04 12:52 Michael Lovett
     [not found] <sd9dae8d.087@farm_groupwise1_srv.morpace-i.com>
2002-10-04 15:20 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).