Article View: comp.lang.modula2
Article #4598Re: "for" loops (was Re: C++ vs. Modula2)
From: Doug Schmidt
Date: Sun, 29 Jan 1989 18:30
Date: Sun, 29 Jan 1989 18:30
35 lines
1664 bytes
1664 bytes
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)
++ <stuff>;
++
versus
i = 0;
LOOP_HEAD:
if (i <= 17) {
<stuff>
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.
Technical Details
Message-ID:
<6224@paris.ics.uci.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!orion.cf.uci.edu!uci-ics!blanche.ics.uci.edu!schmidtReferences:
<INFO-M2%89011219330825@UCF1VM> <739@jupiter.iis.UUCP> <1611@csuna.UUCP> <1626@csuna.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <INFO-M2%89011219330825@UCF1VM> <739@jupiter.iis.UUCP> <1611@csuna.UUCP> <1626@csuna.UUCP> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt <schmidt@blanche.ics.uci.edu> Organization: University of California at Irvine: ICS Dept. Lines: 35