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

Dave Seaman ags at s.cc.purdue.edu
Sat Jan 28 05:09:13 AEST 1989


In article <19579 at agate.BERKELEY.EDU> bowles at eris.berkeley.edu (Jeff A. Bowles) writes:
>   If I had a nickel for every time, in Fortran,
>   that I needed a loop that ran from 0.0 to 1.0 by 0.1 (or the like) and
>   had to use INTEGER to do it. 

Fortran does not require an integer.  The control variable of a DO loop may
be integer, real, or double precision.  It is perfectly legal to write:

	REAL X
	. . .
	DO 10 X=0.0, 1.0, 0.1
	. . .

according to the current standard, but this has been recognized as a
mistake which will probably be rectified in the next standard.  You can't
even tell how many iterations you will get from the DO statement above
(10? 11? how do you know?).  Why anyone would want to add this deficiency
to a language that doesn't currently have broken FOR statements is beyond
me.

-- 
Dave Seaman	  					
ags at j.cc.purdue.edu



More information about the Comp.lang.c mailing list