structured programming

Kemp at dockmaster.arpa Kemp at dockmaster.arpa
Mon Mar 6 03:07:25 AEST 1989


> From: John Chambers <jc at minya.uucp>
> Most languages' standards/specs/whatever allow the compiler writer to
> handle the null case in a way that makes the non-null case the fastest;
> C compiler writers aren't allowed such trickiness.  It's a real help to
> know that the code will loop just as many times as I tell it, no more,
> and no less.  It's also a big help to know that the "control variable(s)"
> are guaranteed to keep their final value, and that the compiler can't
> play efficiency games that work differently on different systems.  I
> like the idea of a program that does exactly what I say, even (especially)
> when there's a "better" way.

The fortran-77 standard doesn't allow "trickiness" that affects the number
of times a loop will be executed based on the whims of the compiler writer.
The exit condition is checked at the beginning of the loop to allow zero
or more executions; and the control variable is guaranteed to retain it's
current value (if you break out of the loop) or the value that caused the
test to fail (if the loop terminates normally).  What could be more
deterministic or explicit?

(Of course fortran-66 one-trip loops were a botch, but 1966 was a LONG
time ago).

Disclaimer: I write mostly in C, I only use fortran for signal processing.
Honest.

---------------------

btw, what is the address for submissions to the unix-wizards digest?
I believe that if this is sent to unix-wizards at sem.brl.mil, it will
go out as its own little message.

   Dave Kemp



More information about the Comp.unix.wizards mailing list