\"break\" statements

Mitchell Lerner lerner at isi-vaxa.ARPA
Fri Nov 1 09:03:52 AEST 1985


>Advocates of 'break <label>' and 'break <nesting-level-number>' should
>meditate a long time to be sure they are not trying to fool themselves.
>These break statements are just a way to disguise a goto statement.
>	The only thing wrong with goto statements (I never use them) is
>that they make code hard to understand.  There are probably rare cases
>when code is made more clear by the use of goto statements.


I agree with Mike, It is probably be clearer code that sets a boolian to false
that gets evaluated by the loops concerend.  This might take time and space,
especialy if more than one of these switches is need in many nested loops,
but these boolians could comment meaninfully why these loops are being 
terminated.

I once found myself wishing that "C" had a "break (#_of_nestings)" statement
but in retrospect I see that I was being lazy and upon returning to this
code to maintain it I am glad that I used boolian switches because they helped
define "states" that exist in the code. Gotos do not do that very well. 

And for those of you who insist that this break statement is a good idea as 
long as the programmer documents what is going on I will remind you of a truth 
that is painfully realized by me too often (especialy in certain Research Laboratories products) and that is (and you may quote me): "COMMENTS LIE, CODE DOESNT!!!".

"I will now relinquish the soap box"

Happy Trails!!!



More information about the Comp.lang.c mailing list