From 3376351493078522620
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,6bd75668e589c3cb
X-Google-Attributes: gidf78e5,public
From: Sam Fenster <fenster@cs.columbia.edu>
Subject: Re: PROPOSAL: Parameterized return/break/continue for nested loops
Date: 1996/10/16
Message-ID: <xmywwwsyu06.fsf@shadow.cs.columbia.edu>#1/1
X-Deja-AN: 189955480
references: <01bbb541$57db1d60$31d8cac6@chico>
x-original-date: 15 Oct 1996 14:14:49 -0400
organization: Computer Science Dept., Columbia University, New York, USA
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com


jbuck@Synopsys.COM (Joe Buck) writes:
> Here I'm throwing an integer, but the type doesn't matter.  The advantage
> over your labeled break scheme is that cleanups automatically occur: if
> objects with constructors are declared inside any of the loops, their
> destructors will be called when you jump out of the loops.

Are you saying that a `break' or `goto' out of a loop won't call the
destructors of that block's local variables?

April WP:
|   6.6  Jump statements                                       [stmt.jump]
| 
| 1 Jump statements unconditionally transfer control.
|           jump-statement:
|                   break ;
|                   continue ;
|                   return expressionopt ;
|                   goto identifier ;
| 
| 2 On   exit   from   a   scope   (however   accomplished),   destructors
|   (_class.dtor_) are called for all constructed objects  with  automatic
|   storage  duration  (_basic.stc.auto_)  (named  objects or temporaries)
|   that are declared in that scope, in the reverse order of their  decla-
|   ration.   Transfer out of a loop, out of a block, or back past an ini-
|   tialized  variable  with  automatic  storage  duration  involves   the
|   destruction  of  variables with automatic storage duration that are in
|   scope at the point transferred from but not at the  point  transferred
|   to.   (See _stmt.dcl_ for transfers into blocks).
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



