Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!rutgers!husc6!mit-eddie!genrad!decvax!ucbvax!hplabs!hpcea!hpfcdc!hpcnoe!jason From: jason@hpcnoe.UUCP (Jason Zions) Newsgroups: net.lang.c Subject: Re: Portable Languages (was: Expression sequencing query) Message-ID: <790007@hpcnoe.UUCP> Date: Thu, 16-Oct-86 13:33:21 EDT Article-I.D.: hpcnoe.790007 Posted: Thu Oct 16 13:33:21 1986 Date-Received: Tue, 21-Oct-86 21:50:41 EDT References: <4504@brl-smoke.ARPA> Organization: HP Colorado Networks Division Lines: 27 dik@mcvax.uucp (Dik T. Winter) writes: > And so should it. Once I required the expression (A - B) - C evaluated > exactly that way. It didn't do so. However, after removing the > parenthesis it was evaluated the way I wanted. Counterintuitive? Not counterintuitive - BROKEN. Although C may rearrange the order of evaluation with respect to + * & ^ and |, it may not do so w.r.t. operators which aren't associative and commutative. Rearranging (A - B) - C is just plain wrong. References: H&S Section 7.11, page 190 K&R Section 2.12, page 49 Note that both references state that reordering is permitted only for the associative and commutative operators; they do not mention the names of the operators for which reordering is forbidden. -- This is not an official statement of Hewlett-Packard Corp., and does not necessarily reflect the views of HP. It is provided completely without warranty of any kind. Lawyers take 3d10 damage and roll a saving throw vs. ego attack. Jason Zions Hewlett-Packard Colorado Networks Division 3404 E. Harmony Road Mail Stop 102 Ft. Collins, CO 80525 {ihnp4,seismo,hplabs,gatech}!hpfcdc!hpcnoe!jason