using break <label> instead of goto <label>

Mark Terribile mat at hou4b.UUCP
Sat Jan 12 04:14:53 AEST 1985


>But what Ron was saying was that if you don't eliminate "goto",
>"break <label>" >just amounts to "semantic sugar" for "goto <label>";
>if you want to discourage people from using "goto" you can just  . . .

Not quite.  You see, if you follow out this philosophy, we can do away with
for(;;) and while() and the else in if()-else ... and compound statements
too.

An upholsterer's tack hammer is no more powerful than a 15-lb maul.  Why use
the tack hammer?  Because it is suited to the job.  More specifically, it lets
you put the force you need where you need it without scattering that force
everywhere else.

The labelled break allow you to get out of (i.e. go to just below) a loop
without making it possible to get there from anywhere else.  Very important.

Viewed differently, the labelled break is the addition of a (presumably) needed
capability to the thing that needs it (the loop and switch statements)
without making the remainder of the program unsafe.
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	hou4b!mat
    ,..      .,,       ,,,   ..,***_*.



More information about the Comp.lang.c mailing list