From -4915999564564845052
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,6bd75668e589c3cb
X-Google-Attributes: gidf78e5,public
From: "Daniel Pflager" <dpflag@ix.netcom.com>
Subject: Re: PROPOSAL: Parameterized return/break/continue for nested loops
Date: 1996/10/11
Message-ID: <01bbb6f8$a1740320$31d8cac6@chico>#1/1
X-Deja-AN: 188825303
references: <01bbb541$57db1d60$31d8cac6@chico> <53f2vu$fd0@panix.com> <m3hgo3ns0p.fsf@gabi-soft.fr> <325D288D.3713@ebc.ericsson.se>
x-original-date: 10 Oct 1996 22:48:46 GMT
organization: Netcom
x-netcom-date: Thu Oct 10  3:48:46 PM PDT 1996
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com


> If possible (and I know it isn't,) I'd very much like to see goto
> removed from C++ (and any other language too, for that matter,)
> once and for all, and have it replaced by something more structured
> that fills the one use of goto I can see that is not a sign of poor
> coding.

I am convinced of at least three good reasons to use gotos for effiency.

I) When shared code in an else clause (or implied else clause) would have
to be repeated with cascading nested ifs to achieve the same result.

II) When error handling code at the end of a procedure needs to be shared
(essentially a special case of I).

III) Recoding without a goto would introduce "state variables" (flags), or
cause the use of micro-functions whose only purpose is to avoid the goto.

HOWEVER, having said all that, I agree that the goto SHOULD be removed, and
replaced with (a) structured equivalent(s). That is why I propose
essentially the naming of compound statements. The compound statement's
name can be used (including scoping rules) by breaks or continues.

The example I gave used the goto syntax, but any suitable syntax could be
used.

Perhaps then, the question is not whether, but how?

What do you say?

Daniel Pflager
---
[ 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 
]



