Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc!uxc.cso.uiuc.edu!gistdev!flint From: flint@gistdev.UUCP Newsgroups: comp.lang.c Subject: Re: "for" loops (was Re: C++ vs. Modula Message-ID: <7800002@gistdev> Date: 31 Jan 89 16:43:00 GMT References: <1611@csuna.UUCP> Lines: 20 Nf-ID: #R:csuna.UUCP:1611:gistdev:7800002:000:1199 Nf-From: gistdev.UUCP!flint Jan 31 10:43:00 1989 I've always felt that it should be the job of programming languages to let me say what I want to do concisely, and then they should do it the way I want. Therefore, there is no reason I can see that the language should not let you have an increment of .1, since it is quite clear exactly what I want it to do in this case: the compiler ought to be able to see (easily) that it needs to set up a dummy integer counter to actually control the loop, and divide by 10 at the top of the loop for you to give you the index you use. By doing so, it allows experienced people to do less typing, and protects beginners from their ignorance- you win both ways. (It cannot necessarily deal with the round-off problems at the end of the loop of course: in the example cited, the question was whether to run the loop for 10 or 11 iterations. However, if the compiler does one division to make that decision & then codes an integer loop for you it's much more likely it will be what you wanted.) Flint Pellett, Global Information Systems Technology, Inc. 1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165 INTERNET: flint%gistdev@uxc.cso.uiuc.edu UUCP: {uunet,pur-ee,convex}!uiucuxc!gistdev!flint