J3/04-210 Date: 2004-01-14 To: J3 From: Walt Brainerd Subject: Clarification of function side effects Date: 2003-12-03 at 20:00:34 Request number: 102 Name: Walt Brainerd E_mail: walt@fortran.com ============================================ Number: Title: Clarification of function side effects Submitted by: J3 Status: For Consideration References: Fortra 2003, Section 7.1.8.1 Basic Functionality: Clarify when a function (especially one with side effects) must be executed. Perhaps a good example is the following. Is the value printed for x predictable? program side_effect ! This is a lot like NOTE 7.15. x = 2.0 y = 0*f(x) print *, x, y contains function f(x) x = x + 1 f = x end function f end program side_effect Rationale: The Fortran 77 interp on this subject was never used to modify the standard in any way and members of J3 seem to disagree on this issue, so that indicates to me that it should be clarified. Estimated Impact: It depends on the way we go. If f doesn't have to be evaluated, and x is unpredictable, the words in 7.1.8.1 need to be made stronger (clearer?). If not, the sections needs a rewrite. [Is my bias showing?] Detailed Specification: Clarify the issue. History: Submitted as Pub-102