Print

Print


Richard E Maine wrote:
> On Nov 7, 2004, at 12:20 PM, Tim Prince wrote:
>
>> Since f95, it should be a bug, if a compiler has optimized away repeat
>> calls to a function which is
>> not declared PURE.
...
> I certainly don't want to reargue all the old points on this subject
> (and I won't reply to any such arguments). I even tried very hard to
> refrain from commenting that this appears to be a current example of a
> problem that wouldn't happen if my advice were followed (namely, to
> avoid counting on function side effects in practice regardless of
> whether or not you think the standard guarantees them in theory).. but
> I couldn't resist.  :-(

Pretty useless advice for the most part anyway.  I don't know the
statistics, but I'd bet a bundle that the percentage of Fortran programmers
that are even aware that there *is* a controversy, much less being
aware of your advice on the subject, is less than one (percent).  *IF*
the standard doesn't already conform to common practice with respect
to this issue (I think it does), then it should be altered to do so.  I think
deletion of most of §7.1.8 (of the CD, it's §7.1.7 of the F95 doc)
is appropriate anyway, just to improve legibility of the standard
if for no other reason.

The case that originated this thread would have been in error
even for PURE functions if the loop contained any changes to
COMMON and/or MODULE variables.  Avoiding side-effects
in the function wouldn't necessarily help.  So, your advice is
doubly useless.

-- 
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