Xref: utzoo comp.lang.c:7840 comp.lang.fortran:508 Path: utzoo!mnetor!uunet!husc6!bloom-beacon!athena.mit.edu!tada From: tada@athena.mit.edu (Michael Zehr) Newsgroups: comp.lang.c,comp.lang.fortran Subject: I forget what it was originally called. Message-ID: <3505@bloom-beacon.MIT.EDU> Date: 5 Mar 88 18:55:52 GMT References: <42586@sun.uucp> <1517@sugar.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: tada@athena.mit.edu (Michael Zehr) Organization: Massachusetts Institute of Technology Lines: 27 Keywords: X3J3 Fortran Draft cpp Summary: order of evaluation Back a week or so ago, there was a discussion about code like: array1[i] = array2[i] = array3[i++]; and all the problems it's caused. Well, I got nailed by that today (well, yesterday actually, but i found out what was wrong today) using: array[j] = array[j -=h]; Now, the interesting part is, I pulled the subroutine out of a personal library of useful things, and it had been tested beforehand. For some strange reason, when it's an array of int, it works, but on other types of arrays it doesn't work. (I guess I shouldn't say work, but rather "has the effect I want", because work implies that it's defined :-) Anyway, this brought up a curious question: do compliers typically produce code with different order of evaluation when compiling the same statements but using different data types? Can anyone point me to a good book that outlines the different things optimizers try to do? Thanks in advance. ------- michael j zehr "My opinions are my own ... as is my spelling."