comp.lang.ada
 help / color / mirror / Atom feed
From: kassover@minerva.crd.ge.com (David Kassover)
Subject: Re: bug me now / bug me later
Date: 14 Jun 90 15:00:50 GMT	[thread overview]
Message-ID: <8551@crdgw1.crd.ge.com> (raw)
In-Reply-To: 23471:Jun1405:22:1090@kramden.acf.nyu.edu

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

      reply	other threads:[~1990-06-14 15:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-06-07 23:26 bug me now / bug me later Jim Harkins
1990-06-08 16:51 ` Charles H. Sampson
1990-06-11 22:19 ` Wade Richards
1990-06-12 13:36 ` Robert Firth
1990-06-14  5:22   ` brnstnd
1990-06-14 15:00     ` David Kassover [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox