🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #4593

Re: "for" loops (was Re: C++ vs. Modula2)

#4593
From: Roger Crew
Date: Sat, 28 Jan 1989 04:37
19 lines
1127 bytes
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).
--
Roger Crew		Copyright 1989 -- All Rights Reserved.   (so there!)
Usenet:    {arpa gateways, decwrl, uunet, rutgers}!polya.stanford.edu!crew
Internet:  crew@polya.Stanford.EDU	
Technical Details
Message-ID: <6419@polya.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!labrea!polya!crew@Polya.Stanford.EDU
References: <19579@agate.BERKELEY.EDU> <8515@lanl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!labrea!polya!crew@Polya.Stanford.EDU
From: crew@Polya.Stanford.EDU (Roger Crew)
Newsgroups: comp.lang.modula2,comp.lang.c
Subject: Re: "for" loops (was Re: C++ vs. Modula2)
Message-ID: <6419@polya.Stanford.EDU>
Date: 28 Jan 89 04:37:58 GMT
References: <19579@agate.BERKELEY.EDU> <8515@lanl.gov>
Sender: crew@polya.Stanford.EDU
Reply-To: crew@Polya.Stanford.EDU (Roger Crew)
Followup-To: comp.lang.modula2
Organization: Stanford University Computer Science Dept.
Lines: 19
In-reply-to: jlg@lanl.gov (Jim Giles)