Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rtp47.UUCP Path: utzoo!linus!philabs!prls!amdimage!amdcad!decwrl!decvax!mcnc!rti-sel!rtp47!meissner From: meissner@rtp47.UUCP (Michael Meissner) Newsgroups: net.lang.c Subject: Re: Unary plus ( + ) Message-ID: <125@rtp47.UUCP> Date: Tue, 6-Aug-85 11:13:46 EDT Article-I.D.: rtp47.125 Posted: Tue Aug 6 11:13:46 1985 Date-Received: Sat, 10-Aug-85 20:43:14 EDT References: <177@hoqam.UUCP> Reply-To: meissner@rtp47.UUCP (Michael Meissner) Distribution: net Organization: Data General, RTP, NC Lines: 15 In article <177@hoqam.UUCP> twb@hoqam.UUCP (BEATTIE) writes: > >I was under the impression that the parentheses already guaranteed >grouping. Do any/some/most/all compilers add a and b and then c? >When is (a+(b+c)) not equal to ((b+c)+a)? > To quote K&R, page 185: Expressions involving a commutative and associative operator (*, +, &, |, ^) may be rearranged arbitrarily, even in the presence of parentheses; to force a particular order of eval- uation, an explicit temporary must be used. Thus, (2.0 + (3.0E30 + (-3.0E30))), currently may be reordered to: ((2.0 + 3.0E30) + (-3.0E30)).