Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!mentor.cc.purdue.edu!mace.cc.purdue.edu!ags From: ags@mace.cc.purdue.edu (Dave Seaman) Newsgroups: comp.lang.pascal Subject: Re: Funny evaluation of functions Message-ID: <3007@mace.cc.purdue.edu> Date: 29 Aug 89 22:35:44 GMT References: <20715@adm.BRL.MIL> <616@lehi3b15.csee.Lehigh.EDU> <4357@cps3xx.UUCP> Reply-To: ags@mace.cc.purdue.edu (Dave Seaman) Organization: Purdue University Lines: 27 In article <4357@cps3xx.UUCP> rang@frith.egr.msu.edu (Anton Rang) writes: >In article <616@lehi3b15.csee.Lehigh.EDU> edkay@lehi3b15.csee.Lehigh.EDU (Ed Kay) writes: >>I was mildly surprised that result was 25 rather than 20, because >>I thought that the evaluation of X might precede the evaluation of >>ONE(X). I should have more clearly stated that I was curious whether >>the STANDARD had anything to say about the issue. And I should have made it clearer when I posted my answer several days ago that I was referring to the standard, which I had in front of me at the time. I just assumed that when I said that "if the function 'one' has side effects, then the result of x*one(x) is implementation-dependent", people would know that I meant THE STANDARD SAYS that the result is implementation-dependent. What other basis could I possibly have had for making the statement? Certainly not by trying the program on different compilers, which proves nothing. The implementation could be wrong. >I don't know whether the standard explicitly says so (not having my copy >with me), but any program which depends on a particular order of >evaluation is erroneous Correct -- and the standard does explicitly say so, as I pointed out in my previous posting. -- Dave Seaman ags@seaman.cc.purdue.edu