Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA
From: cottrell@nbs-vms.ARPA (COTTRELL, JAMES)
Newsgroups: net.lang.c
Subject: I break for(;;) loops
Message-ID: <1820@brl-tgr.ARPA>
Date: Tue, 1-Oct-85 14:03:27 EDT
Article-I.D.: brl-tgr.1820
Posted: Tue Oct  1 14:03:27 1985
Date-Received: Thu, 3-Oct-85 06:27:39 EDT
Sender: news@brl-tgr.ARPA
Lines: 44

/* Terry Poot writes:
> >	for (;;) {
> >		ch=getch();
> >		if ((ch>='1'&&ch<='5')||ch=='E') break;
> >		putchar(BELL);
> >	}
> Some of us feel the same about breaks as we do about gotos. I won't use
> it, or continue either, and I won't let anyone in my shop use it. It is
> just a goto with an implicit label, and destroys the ability to
> determine program flow from the FORM of the source even more
> drastically, as there is no label to catch your eye and alert you to the
> presence of the d*mned thing. The only way I will use a break is in a
> set of macros implementing a middle exit loop construct. We use
> LOOP...LOOPUNTIL...ENDLOOP. I know, adding features to a language with
> #define has problems, but at least that code is readable once you know
> what the constructs do, which is quite apparent. C should have that
> structure built in. Since it doesn't, we add it. The keywords are at the
> same indentation level, of course. 

Chicken! There is nothing wrong with a break statement. Most *real*
programmers don't have any difficulty with it, so why do you?
The fact that there is no label is a blessing, as then you can
jump there from *anywhere*, so you have to look for it. I suppose you
don't like `return's in the middle of a funxion either! Most of us
would rather see a well used break than an extra `if' statement
surrounding the `broken :-)' code and and extra boolean flag.

On the other hand, maybe C should have two kinds of breaks, one
for loops, one for switches. Multiple breaks have been discussed
before (please not again) & the general consensus seems to be
1) these aren't used too often & therefore there is no *pressing* need
2) you can easily miscount levels so just use a goto.

You will not receive my resume in the mail. Or many others.
 
> (-: Someone challenged me to produce flames. This should do it :-)

Yer durn tootin!


	jim		cottrell@nbs
*/

------