Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site arizona.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!whuxl!houxm!ihnp4!arizona!rogerh
From: rogerh@arizona.UUCP (Roger Hayes)
Newsgroups: net.lang.c
Subject: Re: Breaking out of several nested loops (& ANSI C)
Message-ID: <16435@arizona.UUCP>
Date: Wed, 10-Oct-84 15:04:46 EDT
Article-I.D.: arizona.16435
Posted: Wed Oct 10 15:04:46 1984
Date-Received: Thu, 11-Oct-84 08:15:45 EDT
References: <1801@pegasus.UUCP>
Organization: Dept of CS, U of Arizona, Tucson
Lines: 41

Tony Hansens' proposal was to allow labels on loops, like
	foo: while (x)
	{
		...
		.{.
			break foo;
		.}.
	}

I like the idea of named loops.  This syntax is very bad (sorry, Mr. 
Hansen).  Is foo a legal label?  Can one say "goto foo"?  Is this fragment
legal?  (If so, what does it mean?)

baz: 	i += j;
	break baz;

I am not pleased with any of the alternatives I have thought of for syntax.
The problem is to give a name to the loop body, without creating an ambiguity
with any other legal construct, and hopefully by using something that will
seem familiar to present C users.  It would be nice to avoid making another 
keyword.

I have thought of, and rejected:
	while (x) foo: { ... } foo	
	while (x) loop foo { ... } foo
	while (x) foo:: { ... } foo

I like the first best, but it does create two kinds of labels (on regular 
statements and on compound statements) with the same syntax, but different
semantics.  I put trailing labels (which must match the name of the loop)
on all of them, because I want a marker to see where the break will jump
to, without counting levels of braces.

	Roger Hayes
	University of Arizona
	Dept. of Computer Science

PS: I am strongly in favor of more-than-6-character-names in the C standard.
In addition to all the reasons advanced so far, the C language is tied pretty
closly to UN*X, and UN*X is headed towards flexnames.  Let the inconvenience 
be on the past (6-chars) not on the future.