At 08:16 AM 11/8/2004, 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 do not know of any change in f95 that justifies such claim. I am
>aware that people disagree on the interpretation of the standard in
>this area, but to my knowledge, none of those disagreements are
>fundamentally tied to differences between f95 and previous versions.
>
>Yes, I know that f95 introduced PURE (well, ok, HPF introduced it, and
>f95 picked it up from HPF), but introducing that new feature didn't
>change the existing ones.
You're certainly in a much better position than I to interpret the
intentions of the committee in introducing PURE functions. I did hedge my
response by indicating a preference for use of the standard facilities for
random numbers and timing calls. There, the standard gave us a clear
direction by requiring subroutines rather than functions, where
optimizations must not disregard side effects.
I may have gone too far in insisting that each time the standard provides a
better alternative to past practice, we should take advantage of it. In
this case, the advantage would be taken by requiring functions to be either
intrinsic or PURE to have repeated calls optimized away.
Tim Prince
|