Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!usc!merlin.usc.edu!nunki.usc.edu!jeenglis From: jeenglis@nunki.usc.edu (Joe English) Newsgroups: comp.lang.c Subject: Re: Oh nooo! (gotos) Message-ID: <4993@merlin.usc.edu> Date: 8 Sep 89 01:04:45 GMT References: <7598@goofy.megatest.UUCP> <12793@pur-ee.UUCP> <1461@atanasoff.cs.iastate.edu> Sender: news@merlin.usc.edu Reply-To: jeenglis@nunki.usc.edu (Joe English) Organization: University of Southern California, Los Angeles, CA Lines: 49 In article <1461@atanasoff.cs.iastate.edu> hascall@atanasoff.cs.iastate.edu.UUCP (John Hascall) writes: >In article <12793@pur-ee.UUCP> lewie@ecn-ee.UUCP writes: >}[...] the equivalent of a continue with a label, i.e.: > >}while foo (...) { >} while (...) { >} ... >} continue foo; >} ... >} } > > I have often wished for something similar, my thoughts have tended toward > the synatx: > > continue [constant-integer-expression]; > break [constant-integer-expression]; > > where the [optional] expression indicated how many nested structures > to continue or break, with the default being 1 (just like the current > "continue" and "break"). Oog... I don't think that's such a good idea; it's easier to look for a label than to count sets of braces -- and check that they belong to a while/for/do and not an if. Plus, if later on you move the code around, adding or deleting loops, you can introduce errors that aren't easy to spot. > While we are on the subject of loops, how do people feel about the > practice of using #define to "extend" the language? For example: > > #define loop for (;;) > #define exitloop break I'm against this in general, but I've seen it used quite effectively in some cases for information hiding: #define foo_iterate(idx,foo) for (idx=foo.items;idx