Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!nrl-cmf!mailrus!tut.cis.ohio-state.edu!ut-sally!utah-cs!utah-gr!uplherc!sp7040!wsccs!val From: val@wsccs.UUCP (Val Kartchner) Newsgroups: comp.lang.c Subject: Re: Another "D" idea (Oh no, not again!) Message-ID: <316@wsccs.UUCP> Date: 14 Mar 88 14:42:07 GMT References: <1170@ucsfcca.ucsf.edu> Lines: 76 Summary: break n; In article <1170@ucsfcca.ucsf.edu>, rk9005@cca.ucsf.edu (Roland McGrath) writes: ...(Some things deleted)... > things like "break 2;" (e.g., > while (x > 0) { while (y != -1) { if (a) break 2; } } > ), which gets into the named control-loop thing, so these are not just > the products of my demented mind. They are the products of the demented > minds of people who get paid lots of money to think of them. I also think that there should be something like "break 'n';" (Where 'n' is a constant integer. Variables would be interesting and floats highly ambiguous.) I've often been deep in multiple loops, and wanted to get out a few levels. Most of the time, I have all the loops that I want to exit in a subroutine, and just return, but sometimes I can't afford the time for the function call and the return. This same time critical restriction is for testing a "flag" variable at EVERY loop condition; I can't always afford the time. /* THE WAY IT IS NOW */ /* WITH "break 'n'" */ void function() int another() { { while(....) do do { { ... for(...) for(...) { { ... while(....) /* funtion() */ if(...) do return; { ... for(...) } { } while(...); ... } if(...) break 3; int another() ... { } do } while(...); { ... ... } for(...) } { } function() ... } } } A similar difficulty could be bypassed in the "switch" statement if this were allowed: for(flag=TRUE;flag;) while(TRUE) { { ... ... switch(function()) switch(function()) { { case ...: case ...: case ...: case ...: ... ... break; break; default: default: flag = FALSE: break 2; break; } } ... ... } } Remember, I ask this to increase the usability of C (C is my computer language of choice), but it must be used with care. It would tend to disabiguize some complex looping structures, but it must not be overused as "goto" often is. -- --- /\ ------------ Val Kartchner {UT@WSC} ---- #include ----- /\/\ . /\ | "Those who don't understand VMS are condemmed to reinvent / \/ \/\/ \ | Unix; those who understand VMS and Unix use VMS." ==/ U i n T e c h \====!ihnp4!utah-cs!utah-gr!uplherc!sp7040!obie!wsccs!val====