Path: utzoo!utgpu!watmath!iuvax!purdue!mentor.cc.purdue.edu!pur-ee!lewie From: lewie@pur-ee.UUCP (Jeff Lewis) Newsgroups: comp.lang.c Subject: Re: Oh nooo! (gotos) Message-ID: <12793@pur-ee.UUCP> Date: 6 Sep 89 19:02:38 GMT References: <7598@goofy.megatest.UUCP> Reply-To: lewie@ecn-ee.UUCP Organization: Purdue University Robot Vision Lab Lines: 35 [Dave Jones offers an example of what he thinks is a valid use of goto]: [code trimmed to get to the meat] > while(rule = (Rule*)Queue_iter_next(&rule_iter)) { > > while(rsym = (Symbol*)Queue_iter_next(&rsym_iter)) { > switch (derives(rsym)) { > case derives_nothing: > goto next_rule; > .... > } > } > > next_rule: continue; > > } I'm sure this comes up often enough, but the reason I'd say there's nothing wrong with this type of goto is that it is the equivalent of a continue with a label, i.e.: while foo (...) { while (...) { ... continue foo; ... } } ('foo' is a loop label, which can be used within the loop's scope to alter flow of control via break or continue) This, I would say, is just as structured as the simple 'break' and 'continue' that I presume most people have no problem with. Of course C doesn't offer this obvious functionality, so you fake it with the occasional 'goto'. Is there anything wrong with this?