Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site eagle.UUCP Path: utzoo!watmath!clyde!burl!ulysses!eagle!mjs From: mjs@eagle.UUCP (M.J.Shannon) Newsgroups: net.lang.c Subject: Re: for <==> while (an exception) Message-ID: <1285@eagle.UUCP> Date: Tue, 16-Jul-85 16:29:49 EDT Article-I.D.: eagle.1285 Posted: Tue Jul 16 16:29:49 1985 Date-Received: Thu, 18-Jul-85 04:35:06 EDT References: <200@ur-cvsvax.UUCP> <314@dcl-cs.UUCP> Distribution: net Organization: AT&T Bell Laboratories, Summit, NJ Lines: 23 > In article <200@ur-cvsvax.UUCP> bill@ur-cvsvax.UUCP (Bill Vaughn) writes: > >Section 3.5 of K&R (p. 56) states that the 'for' loop and 'while' loop > >can be made equivalent i.e. [ elided to save net cost ] > >Are there any other exceptions? > > Here's another ... > An infinite "for" loop is given by "for (;;) statement". The equivalent > "while" expression is, logically, "while () statement". As this fails to > compile, one has to resort to "while (1) statement"; which is less efficient > in most cases as code is generated to test if "1" equals "0". > -- > UUCP: ...!seismo!mcvax!ukc!dcl-cs!stephen To reiterate, the specification of the C language (at the time) is in the Reference Manual, which is at the end of K&R. The content of the rest of the book is meant to be a tutorial. What may seem logical conclusions from the tutorial are spelled out (or disspelled) in great detail in the Reference Manual. -- Marty Shannon UUCP: ihnp4!eagle!mjs Phone: +1 201 522 6063