Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!munnari.oz.au!bruce!goanna!chudich!koel!rcosw From: rcosw@koel.co.rmit.oz (Simon Wail) Newsgroups: comp.lang.pascal Subject: Pascal Assignment statements Message-ID: <723@chudich.co.rmit.oz> Date: 5 Oct 89 03:23:10 GMT Sender: news@chudich.co.rmit.oz Lines: 38 I have a question about expression evaluation in assignment statements in Standard Pascal. 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??? x[5].ptr^.y := f; where "f" is a function that modifies the fifth element of the array "x" so "ptr" points to a different record. Is the old value of "ptr" used to modify "y" or the new value of "ptr" changed in "f"???? I know these are examples of terrible side-effects and bad programming style, but when one is writing a Pascal compiler it is necessary to take into account all the possibilities and to be consistent when evaluating expressions. Thanks. ------------------------------------------------------------------------------- Simon Wail, Post Graduate Student. ACSnet: rcosw@koel.co.rmit.oz UUCP: ...!uunet!munnari!koel.co.rmit.oz!rcosw PHONE: + 61 3 660 2726 ARPA: rcosw%koel.co.rmit.oz@uunet.uu.net RMIT / CSIRO Parallel Systems Architecture Project, Department of Communication and Electrical Engineering, Royal Melbourne Institute of Technology, P.O. Box 2476V, Latrobe St, Melbourne. 3000. Australia.