Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ctvax Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!inuxc!pur-ee!uiucdcs!convex!ctvax!pedz From: pedz@ctvax Newsgroups: net.sources Subject: Re: Orphaned Response Message-ID: <42500014@ctvax> Date: Mon, 25-Nov-85 17:56:00 EST Article-I.D.: ctvax.42500014 Posted: Mon Nov 25 17:56:00 1985 Date-Received: Thu, 28-Nov-85 04:18:51 EST References: <1312@wanginst.UUCP> Lines: 35 Nf-ID: #R:wanginst.UUCP:1312:ctvax:42500014:000:1160 Nf-From: ctvax!pedz Nov 25 16:56:00 1985 I will probably regret this but here goes. The sequence of i = 1; j = ++i + (++i + ++i); can not leave j with a value of 12. In fact, the value can not be greater than 9 and or less than 6. My line of reasoning is this: Suppose we have the statement: j = (i = 2) + (i = 3); This will clearly leave j with the value of 5 but i's value may be 2 or 3. The statement ++i is the same as i += 1 which is the same as i = i + 1. (I realize that if i were some expression with side effects, the first two expressions are suppose to cause the side effect only once but thats not important with a simple variable like i.) Thus if we convert the above statement we have j = (i = i + 1) + (i = i + 1) + (i = i + 1) Since we go in with i = 1, at least one of the factors will return a value of 2. All of them could return a value of 2. One or two of them could return a value of 3, and not more than one of them may return a value of 4. Thus the highest value is 9, not 12. I realize also that this is a stupid point, the example was only done in fun, and there are many other obvious reasons to flame me but I just had to say this. Perry Smith pedz@ctvax