Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!mimsy!tank!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.lang.pascal Subject: Re: Funny evaluation of functions Summary: Programs depending on order of evaluation are erroneous Message-ID: <4357@cps3xx.UUCP> Date: 29 Aug 89 19:18:47 GMT References: <20715@adm.BRL.MIL> <616@lehi3b15.csee.Lehigh.EDU> Reply-To: rang@frith.egr.msu.edu (Anton Rang) Organization: Engineering, Michigan State University, E. Lansing Lines: 22 In article <616@lehi3b15.csee.Lehigh.EDU> edkay@lehi3b15.csee.Lehigh.EDU (Ed Kay) writes: > > When I originally posed the question about the evaluation of: [ ... ] > >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. 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--it isn't legal Pascal (though it may be syntactically correct). Ada explicitly distinguishes classes of errors which the compiler MUST detect or MAY detect; dependence on order of evaluation is an error, whether the compiler yells about it or not. Anton +----------------------------------+------------------------+ | Anton Rang (grad student) | "UNIX: Just Say No!" | | Michigan State University | rang@cpswh.cps.msu.edu | +----------------------------------+------------------------+