Re: Function PRESENT and logical combinations

From: James Giles (
Date: 06/17/04

Date: Wed, 16 Jun 2004 23:16:24 GMT

Richard Maine wrote:
> "James Giles" <> writes:
>> Of course, for
>> non-PURE functions, the compiler must prove even more: that
>> the procedure itself has no side-effects that have further consequences
>> in the program.
> I was tempted to quote the exact words of the official f77
> interpretation that I think contradict the above "must" in words that
> I couldn't imagine being any more explicit. [...]

Go ahead. The interp is
Every time you've brought up that interp, you've deliberately left
the single sentence you refer to out of context.

We've already discussed the circumstances referred to in the
interp in this thread. They are those instances where the standard
explicitly permits *expressions* to be evaluated in clearly
defined alternative ways that completely remove the reference
to the function.

Yes, as I've agreed many times, in a construct like:

   X = 0 * F(A)

The implementation is free to evaluate a mathematically
equivalent expression:

   X = 0

Similar alternatives exist for logical and character expressions
as explicitly mentioned in 7.1.8 of the F2003 document (or,
7.1.7 of the F95 document).

This does *not* constitute a different way of evaluating *functions*.
The side-effects either occur as defined within the function
(indicating the implementation did not choose to use the permitted
alternative expression), or the side-effects don't occur at all. If
the permitted transformations of 7.1.8 don't apply to a given
expression, then any functions referenced in the expression must
be evaluated, and the only means of doing so mentioned anywhere
in the standard is by its execution.

> I really should just announce a global pre-reply, since these
> statements keep getting made without the qualifier, that every time
> someone says "must" or equivalent words, an implicit "in my
> [the poster's] opinion" should be added...

Every time anyone says *anything* in *any* context, unless it
directly attributed to someone else, the assumption that the
person is expressing a position in agreement with his own
is valid. Who else's opinion is someone likely to post? You
are asking for redundant qualifiers.

J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies."  -- C. A. R. Hoare