From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!crdgw1!minerva!kassover From: kassover@minerva.crd.ge.com (David Kassover) Newsgroups: comp.lang.ada Subject: Re: bug me now / bug me later Message-ID: <8551@crdgw1.crd.ge.com> Date: 14 Jun 90 15:00:50 GMT References: <811@sagpd1.UUCP> <7498@fy.sei.cmu.edu> <23471:Jun1405:22:1090@kramden.acf.nyu.edu> Sender: news@crdgw1.crd.ge.com Distribution: usa Organization: Aule-Tek, Inc. List-Id: In article <23471:Jun1405:22:1090@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu writes: >In article <7498@fy.sei.cmu.edu> firth@sei.cmu.edu (Robert Firth) writes: >> In article <811@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes: >> > a. for(i = SIZE; i != 0; i -= STEP) >> > b. for(i = SIZE; i > 0; i -= STEP) >> First, the coding of the loop should have nothing to do with the values >> of SIZE and STEP. The code you write should be determined by the >> postcondition you wish to establish. > >Say what? Who cares what the value of i is after the loop? ... >Again, who says there has to be a postcondition? The programmer is >thinking about the values i will take on trips through the loop, not >about the value it'll have afterwards. That would depend on the loop contents and the programmer, now wouldn't it? And in some sense the analyst who wrote the specification for a task that the programmer chooses to solve with the loop. Of course, if one is of the school of thought that a loop must have only one entrance and only one exit, one has to put in additional code and a different variable from the loop control variable to indicate, say, an index into a structure of a particular feature of that structure. And possibly waste large amounts of cycles searching the entire structure for information that is already found, and possibly will not be found. Ada has control structures that help with both scenarii (I'm assuming scenario is from the Italian 8-). This was crossposted to comp.lang.ada, and comp.lang.c. Since I don't read the latter, I have not followed up there. -- David Kassover "Proper technique helps protect you against kassover@ra.crd.ge.com sharp weapons and dull judges." kassover@crd.ge.com F. Collins