Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site pegasus.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!hogpc!pegasus!hansen
From: hansen@pegasus.UUCP
Newsgroups: net.lang.c
Subject: Re: Breaking out of several nested loops (& ANSI C)
Message-ID: <1801@pegasus.UUCP>
Date: Mon, 8-Oct-84 15:26:01 EDT
Article-I.D.: pegasus.1801
Posted: Mon Oct  8 15:26:01 1984
Date-Received: Tue, 9-Oct-84 03:59:29 EDT
References: <129@ssc-vax.UUCP>
Distribution: net
Organization: AT&T Information Systems, Lincroft NJ
Lines: 47

One of the proposals that was supposed to be brought up before the last
committee meeting was a way to make breaking out of deeply nested loops
structured such that the following:

>> 	i=1;
>> 	while(...){
>> 		...
>> 		for(...;...;...){
>> 			...
>> 			switch(...){
>> 				...
>> 				goto Out;
>> 			}
>> 		}
>> 	}
>> Out:	i=2;
>> 

would become:

>> 	i=1;
--  whileloop:
>> 	while(...){
>> 		...
>> 		for(...;...;...){
>> 			...
>> 			switch(...){
>> 				...
-- 				break whileloop;
>> 			}
>> 		}
>> 	}
>>	i=2;
>> 

The idea is to be able to label while, for and do-while loops and be able to
use those labels on break and continue statements. This provides for a very
structured and much more readable and maintainable coding style, in my
opinion, than the equivalent code using goto's or separate procedures. This
feature is commonly called a "break n" capability in the literature and
other languages.

What does everyone think? Is this a worthy attempt at making the language
more structured and orthogonal? Send in your votes!

					Tony Hansen
					pegasus!hansen