Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/26/83; site ihuxq.UUCP Path: utzoo!linus!security!genrad!grkermit!mit-vax!eagle!mhuxt!mhuxi!mhuxa!houxm!ihnp4!ihuxq!cscussel From: cscussel@ihuxq.UUCP Newsgroups: net.lang.c Subject: "Break" and other ways out of loops and switches Message-ID: <302@ihuxq.UUCP> Date: Mon, 22-Aug-83 22:30:44 EDT Article-I.D.: ihuxq.302 Posted: Mon Aug 22 22:30:44 1983 Date-Received: Wed, 24-Aug-83 02:06:58 EDT Organization: BTL Naperville, Il. Lines: 22 The recent article asking why "break" replaced "endcase" reminded me of the following. A high school student (!) that I help with his compiler over occassional lunch hours came up with what I think is a super way out of the multiple-level or multiple-construct break problem (i.e., breaking out to the "right" level (the one you want)). He suggested labelling the initial statement of the construct to be "broken" (e.g., the "for" statement) and then giving the label as an "argument" to break. This binds the break to the construct that it's suppossed to break, even if intervening code is deleted or added. It's reminiscent of the way some people comment their code (e.g., break; /* end scan */ becomes break scan ; ). This idea was original with this student, although I've since found out that other languages (such as BLISS) have this feature. I think that it's great, would be relatively easy to add to compiler (I think), and is even compatible with the current C. Multiple-level breaks are a common reason for seeing one of those rare goto's in modern code. This feature would eliminate the need those occurrances. Well, what do do you think, yea or nay? Chris Scussel Bell Labs Naperville, Illinois ihuxq!cscussel