Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ptsfa!pacbell!att-ih!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Another "D" idea (Oh no, not ag Message-ID: <225800015@uxe.cso.uiuc.edu> Date: 20 Mar 88 14:22:00 GMT References: <25743@cca.CCA.COM> Lines: 40 Nf-ID: #R:cca.CCA.COM:25743:uxe.cso.uiuc.edu:225800015:000:1377 Nf-From: uxe.cso.uiuc.edu!mcdonald Mar 20 08:22:00 1988 > ... suggesting a break n construct to escape n levels up. >Some languages have this. It doesn't really work very well. The >problem is that it is a maintenance nightmare. If you have deeply >nested code (and that is where this thing would be used) and you >change an intermediate level of nesting you also have to change all >of those lower level 'break n's. Moreover it can be, shall we say, >obscure as to where that 'break 5' is returning control to. >I am inclined to believe that labelled escapes are somewhat better. >We have already gone over this one, and several people with large >clubs have convinced me that it is not worth bothering with. >The situation boils down to this: There is no good way in block >structure code to deal with multi-level escapes. It appears to be >a fundamental property of block structured code. >There is only one real cure: Don't write deeply nested code that >needs multi-level escapes. C has a construct just exactly for this situation. It is easy to use, portable, and very easy to maintain, because it doesn't depend on the way loops nest: while ( ick) { for (i = 2633; i < 7399; i += 23 ){ do { while(foo() ) { ... if(We_finished_early) goto all_the_way_out; } } while(mm < -11 ); } } all_the_way_out: ... Doug McDonald