Xref: utzoo comp.lang.modula2:1229 comp.lang.c:15872 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!orion.cf.uci.edu!uci-ics!blanche.ics.uci.edu!schmidt From: schmidt@blanche.ics.uci.edu (Doug Schmidt) Newsgroups: comp.lang.modula2,comp.lang.c Subject: Re: "for" loops (was Re: C++ vs. Modula2) Message-ID: <6224@paris.ics.uci.edu> Date: 29 Jan 89 18:30:36 GMT References: <739@jupiter.iis.UUCP> <1611@csuna.UUCP> <1626@csuna.UUCP> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt Organization: University of California at Irvine: ICS Dept. Lines: 35 In article <1626@csuna.UUCP> abcscagz@csuna.csun.edu (Jeff Boeing) writes: ++Hoo boy, did I ever mess up in my last posting. ++I forgot that a C "for" loop may be executed zero times. ++So, let me rephrase my conviction that a C "for" loop is superfluous ++because it can be replaced by an equivalent "while" loop, NOT an ++equivalent "do ... while" loop: I don't think you've gone far enough. After all, can't both a while loop and a for loop be replaced by an if statement and a goto? ++ ++ for (i = 0; i <= 17; i = sqr(i) + 2) ++ ; ++ versus i = 0; LOOP_HEAD: if (i <= 17) { i = sqr(i) + 2; goto LOOP_HEAD; } In fact, aren't all high-level control constructs superfluous? Doug p.s. ;-) ...... -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.