Path: utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!reed!reeder From: reeder@reed.UUCP (Doug Reeder) Newsgroups: comp.lang.pascal Subject: Re: Pascal Assignment statements Message-ID: <13382@reed.UUCP> Date: 7 Oct 89 11:46:28 GMT References: <723@chudich.co.rmit.oz> Reply-To: reeder@reed.UUCP (Doug Reeder) Organization: Reed College, Portland OR Lines: 30 In article <723@chudich.co.rmit.oz> rcosw@koel.co.rmit.oz (Simon Wail) writes: >Q. Is all address calculations of the assignment variable performed before > the expression on the R.H.S. is evaluated??? >Some examples that cause problems : >x[a+b] := f; > where "f" is a function that modifies the global variables "a" and "b" > which are used to index the array on the L.H.S. Is the index to the > array calculated before "f" is called??? From "Pascal For Programmers" by Lecarme & Nebutt (McGraw-Hill 1984) p27-28: "The order in which the two sides of the assignment statement are evaluated is implementation-dependent; i.e., a correct program must not depend on this order." Also, the terms in an expression are evaluated in an implementation-defined manner. Thus, you can do whatever you like and don't even have to always do the same thing. The book, by the way, is an excellent reference for the experienced programmer. I consult mine all the time. -- Doug Reeder USENET: ...!tektronix!reed!reeder Box 722 Reed College BITNET: reeder@reed.BITNET Portland, OR 97202 from ARPA: tektronix!reed!reeder@berkeley.EDU (503) 777-1551 "A blaster can point two ways." -Salvor Hardin