break <label> != goto <label>

Chris Scussel trough at ihuxi.UUCP
Fri Jan 11 03:01:05 AEST 1985


There seems to be some confusion on the suggested "break <label>" construct.
I believe the suggestion is:

		label: for ( ... )
			{
				...
				break label ;
				...
			}

Some folks apparently interpreted the suggestion as meaning

			for ( ... )
			{
				...
				break label ;
				...
			}
		label:	...

which does differ from a vanilla goto, but not by much.
I believe that the first interpretion is both nicely structured and useful.
The "break" is associated with the construct it breaks by the label,
so the suggestion is relatively robust in the face of code changes,
unlike "break <n>", "goto <n>", and the alternate interpretation
of "break <label>".

	I must admit that when I first heard of this a couple of years
back I also misinterpreted it to be not much more than a goto. When
it was explained to me what was really meant I became an instant convert,
and have liked it ever since. (Just for fun, I added it to a C interpreter
I had written. It was trivial.)

				Chris Scussel
				AT&T Bell Labs
				ihnp4!ihuxi!trough



More information about the Comp.lang.c mailing list