Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!bellcore!ulysses!allegra!mit-eddie!genrad!decvax!mcnc!rti-sel!dg_rtp!throopw From: throopw@dg_rtp.UUCP (Wayne Throop) Newsgroups: net.lang.c Subject: a=(b=1,b)+(b=2,b)+(b=3,b); /*ANSI does NOT say a=6*/ Message-ID: <612@dg_rtp.UUCP> Date: Thu, 2-Oct-86 11:20:39 EDT Article-I.D.: dg_rtp.612 Posted: Thu Oct 2 11:20:39 1986 Date-Received: Sat, 4-Oct-86 10:50:28 EDT Lines: 29 Some folks have said that since (,) expressions are sequence points, the result of the expression in the Subject: line must be 6. I don't think so. I could be wrong, but it seems pretty straightforward to me. Take this example: (e1,e2)+(e3,e4) Now, the way I read ANSI, the sequence points at the (,) expressions prohibit the interleaving of the evaluation of e1 and e2, and similarly prohibits the interleaving of e3 and e4. But it does *NOT* (as far as I can tell) prohibit the interleaving of e1 and e3, e1 and e4, e2 and e3, or e2 and e4. Thus, in the example that started the whole thing (the expression in the Subject: line) the result could legitimately be anything from 3 to 9, inclusive. It is true that Harbison and Steele proposed a more restrictive set of interleaving prohibitions. These were *NOT* adopted by ANSI. And, perhaps more importantly, they were never implemented by most compilers. Therefore, it is unwise to expect the H&S recommended behavior, since most compilers do not adhere to it, and it is *INCORRECT* to say that compilers that do not adhere to it are "buggy" or "broken", since both K&R and the ANSI standard disagree with H&S on this point. -- At one point I thought it would be easier to rewrite all my books without using the letter 's'. --- D.E. Knuth -- Wayne Throop !mcnc!rti-sel!dg_rtp!throopw