Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!altos!vsi1!teda!ditka!comeau From: comeau@ditka.Chicago.COM (Greg Comeau) Newsgroups: comp.sys.amiga.programmer Subject: Re: Compiler code (was a flame fest) (now a lesser flame fest) Message-ID: <37499@ditka.Chicago.COM> Date: 26 Apr 91 14:17:15 GMT References: <91112.093750GHGAQZ4@cc1.kuleuven.ac.be> <1991Apr23.020319.7216@engin.umich.edu> <91113.092907GHGAQZ4@cc1.kuleuven.ac.be> Reply-To: comeau@csanta.attmail.com (Greg Comeau) Organization: Comeau Computing Lines: 31 In article <91113.092907GHGAQZ4@cc1.kuleuven.ac.be> GHGAQZ4@cc1.kuleuven.ac.be writes: >I thought that ALL --x or ++x operators where to be evaluated BEFORE the >evaluation of the total expression happens (and this is presumably also >what happens) and that ALL x++ or x-- operators where to be evaluated >AFTER the evaluation of the total expression (and this is presumably >not true). This would seem more logical to me. As this thread has amply demonstrated, the "total expression" is not always the issue. This is a ramification of the order of side-effects, whose order is undefined. Let's see now.... Ok, here is what ANSI C, section 3.3 has to say: "the order of evaluation of subexpressions and the order in which side effects take place are both unspecified" So, not only are we not told whethere the left of right hand side is evaluated first in this (X)*(Y) situation where X and Y and --x et al, but we are also not told when the post- and re-fixes are done either. So yes, the --x will decrement the x before usage, however if that was X and ++x was Y, the -- is not necessarily done first. Taking what I'll call a strict look at all this, point in fact is that the value of the expression is formally undefined even though most compilers will generates some combinationally predicatable value. - Greg -- Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418 Producers of Comeau C++ Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421 Voice:718-945-0009 / Fax:718-441-2310