"break" statements
D Gary Grady
dgary at ecsvax.UUCP
Fri Nov 1 01:31:48 AEST 1985
> These break statements are just a way to disguise a goto statement.
Why stop with break statements? The switch statement is just a way of
disguising a multiway GOTO! While, for, and do statements are merely
GOTOs and conditional GOTOs in Clever Plastic Disguises!
> The only thing wrong with goto statements (I never use them) is
> that they make code hard to understand.
> Michael Shannon {ihnp4,hplabs}!oliveb!3comvax!mikes
The reason true GOTO statements are hard to understand is that it is
impossible to tell at a glance whither they go (up? down?) and it makes
it damned hard at the target address to figure whence cometh the flow.
By careful indentation (and the wise avoidance of the sin of long
loops) one can avoid these failings of the GOTO and still have the
advantages of break (and continue). For example:
while ... {
...statements...
if ... break;
...statements...
}
By the way, note how a reasonable word of advice ("don't use GOTOs") can
be transformed by religious fervor into an absolute prohibition ("thou
shalt not use GOTOs or anything that could be remotely construed as a
GOTO, or thine arse is like unto the grass of the fields, thou sucker").
--
D Gary Grady
Duke U Comp Center, Durham, NC 27706
(919) 684-3695
USENET: {seismo,decvax,ihnp4,akgua,etc.}!mcnc!ecsvax!dgary
More information about the Comp.lang.c
mailing list