Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!xylogics!world!burley From: burley@world.std.com (James C Burley) Newsgroups: comp.lang.fortran Subject: Re: Function calls in the middle of subroutine CALLs? -- Is it standard fortran 77 ???? Message-ID: Date: 20 Jul 90 02:07:45 GMT References: <57505@lanl.gov> Sender: burley@world.std.com (James C Burley) Organization: The World Lines: 22 In-Reply-To: jlg@lanl.gov's message of 19 Jul 90 16:57:01 GMT Also, I think the standard allows an implementation to take a statement like X = Y * FN(Z) and, if Y is 0.0 at compile time or even at run time, skip the call to FN(Z) (which might have side effects) and just produce a result of 0.0. If FN might define Z in the call, then Z is considered undefined after such a statement (even if the compiler you're using does no such optimization) because it MIGHT have not actually gotten defined; you can't even expect Z to have "either the old or new value, depending on whether F(Z) ever got called", if you're writing a standard-conforming program. I guess the real issue is that Fortran is a language primarily for the expression of mathematical formulas, in which side effects and operation ordering do not play a role. When you care about side effects and ordering, you are told to use separate statements (or other sequence points like IF (condition) statement, where condition is guaranteed to be tested before statement gets executed). Only computational vs. mathematical issues are introduced in Fortran expressions, so A*(B*C) is not computationally the same as (A*B)*C even though they are mathematically the same; but that is necessary because Fortran is a computational-model math blaster.