Path: utzoo!dciem!nrcaer!cognos!brianc From: brianc@cognos.uucp (Brian Campbell) Newsgroups: comp.lang.c Subject: Re: Another "D" idea (Oh no, not again!) Message-ID: <2571@cognos.UUCP> Date: 28 Mar 88 16:48:28 GMT Article-I.D.: cognos.2571 Posted: Mon Mar 28 11:48:28 1988 References: <1170@ucsfcca.ucsf.edu> <316@wsccs.UUCP> Reply-To: brianc@cognos.UUCP (Brian Campbell) Organization: Cognos Incorporated, Ottawa, Canada Lines: 28 In article <316@wsccs.UUCP> val@wsccs.UUCP (Val Kartchner) writes: > 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. I brought this one up some time ago. I think the response was the usual "lack of prior art." My suggestion was to add labels to looping constructs: while (...) :top while (...) break :top; if (...) continue :top; The label is far less confusing and requires less maintenance than specifying the number of levels to exit. It should also make the compiler's job easier since it is specifically told that interior statement blocks may be exited abnormally. I think the syntax is interesting. It resembles a label "in reverse" and in fact tells the compiler to insert a label at the end of the current statement block. I don't know where braces should go though... -- Brian Campbell uucp: decvax!utzoo!dciem!nrcaer!cognos!brianc Cognos Incorporated mail: POB 9707, 3755 Riverside Drive, Ottawa, K1G 3Z4 (613) 738-1440 fido: (613) 731-2945 300/1200, sysop@1:163/8