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!gatech!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: Loop "Equivalencies" Message-ID: <3382@brl-tgr.ARPA> Date: Tue, 19-Nov-85 08:52:26 EST Article-I.D.: brl-tgr.3382 Posted: Tue Nov 19 08:52:26 1985 Date-Received: Thu, 21-Nov-85 04:05:35 EST References: <10200026@ada-uts.UUCP> Organization: Ballistic Research Lab Lines: 23 > In Appendix A (C Reference Manual), p. 202, and p. 56, it says that > the following: > > for (expr1; expr2; expr3) > statement > > is equivalent to: > > expr1; > while (expr2) { > statement > expr3; > } > > This is not true if "statement" is a block which contains a "continue" > since, in the first case, "expr3", is executed after the continue but > is not in the second case. > > Am I missing something? No, you have caught K&R in a misleading statement. The equivalence is only approximate, and continue breaks the strict equivalence. Harbison & Steele (p. 209) have this right.