Article View: comp.lang.modula2
Article #4624Re: "for" loops (was Re: C++ vs. Modula2)
From: Geoff Rimmer
Date: Thu, 02 Feb 1989 17:56
Date: Thu, 02 Feb 1989 17:56
42 lines
2190 bytes
2190 bytes
In article <6419@polya.Stanford.EDU> crew@Polya.Stanford.EDU (Roger Crew) writes:
>Here's a quiz:
>How would you write the following in C?
>
> VAR a, b, c : Char;
> ...
> FOR c = a TO b DO ... END;
>
>You can even assume that the body of the loop affects neither a nor b.
>Hint: the answer is *not*
>
> char a, b, c;
> ...
> for (c = a; c <= b; ++c) { ... }
>
>(just try a = 0 and b = 255 in the case of 8 bit chars).
>--
What a stupid question. If you are going to count from 0 to 255, you
wouldn't use char in the first place - you'd use unsigned char, or
int. I can't see what you're getting at, at all.
Go back to writing Fortran. Let the *real* programmers use C. :-)
>Roger Crew Copyright 1989 -- All Rights Reserved. (so there!)
>Usenet: {arpa gateways, decwrl, uunet, rutgers}!polya.stanford.edu!crew
>Internet: crew@polya.Stanford.EDU
------------------------------------------------------------
Geoff Rimmer, Computer Science, Warwick University, England.
geoff@uk.ac.warwick.emerald
"I didn't ask to be made. No consulted me or considered my
feelings in the matter, not that anyone considered that I
might *have* feelings. After I was made, I was left in a
dark room for six months, and me with this terrible pain in
all the diodes down my left side. My one and only true
friend was a small rat. One day it climbed into a cavity of
my inner leg and died. I've a horrible feeling it's still
there." - Marvin, The Hitch Hiker's Guide to the Galaxy.
------------------------------------------------------------
Technical Details
Message-ID:
<1004@ubu.warwick.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sm.unisys.com!hplabs!hp-sdd!ncr-sd!ncrlnk!uunet!mcvax!ukc!warwick!geoffReferences:
<19579@agate.BERKELEY.EDU> <8515@lanl.gov> <6419@polya.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sm.unisys.com!hplabs!hp-sdd!ncr-sd!ncrlnk!uunet!mcvax!ukc!warwick!geoff From: geoff@warwick.UUCP (Geoff Rimmer) Newsgroups: comp.lang.modula2,comp.lang.c Subject: Re: "for" loops (was Re: C++ vs. Modula2) Message-ID: <1004@ubu.warwick.UUCP> Date: 2 Feb 89 17:56:22 GMT References: <19579@agate.BERKELEY.EDU> <8515@lanl.gov> <6419@polya.Stanford.EDU> Sender: news@warwick.UUCP Reply-To: geoff@emerald.UUCP (Geoff Rimmer) Organization: Computer Science, Warwick University, UK Lines: 42