Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.misc Subject: Re: "for" loops Message-ID: <16022@mimsy.UUCP> Date: 18 Feb 89 19:50:44 GMT References: <15692@mimsy.UUCP> <8618@lanl.gov> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 In article <8618@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >Here's where we part company in a big way. I oppose ANY language construct >that requires the programmer to know internals about how the construct >is performed. I will agree that `dark corners' or ambiguities are problematical (and C is full of them, so that programmers must exercise restraint; alas, many do not). But the number of iterations of a loop had better not be a `dark corner'! If you cannot predict the trip count given the limits and increments, you have no business writing that loop in the first place! >.... Many Fortran compilers actually implement DO loops with real limits >in the above manner [avoiding accumulated roundoff errors]. The standard >should really specify that this should be done so the user needn't worry >about it. And if the standard says it, or just as importantly if it does *not*, programmers using the language should be aware of it! If the standard says that DO-loop trip counts depend on the phase of the moon, the programmer should be prepared to look out the window as necessary. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris