Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!wuarchive!ukma!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Short circuit evaluation/expression rearrangement (2nd summary) Message-ID: <16283@smoke.brl.mil> Date: 28 May 91 10:02:25 GMT References: <1991May27.113628.26880@ucthpx.uct.ac.za> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1991May27.113628.26880@ucthpx.uct.ac.za> gram@uctcs.uucp (Graham Wheeler) writes: >From: worley@compass.COM >... in "a + b + c", >the first addition must be performed before the second, because it >associates as "(a + b) + c", showing that the second addition has as >an argument the result of the first. The above is incorrect. A conforming implementation is obliged to perform the operations so that it doesn't create an exception where one would not have occurred in evaluating the expression strictly according to the precedence implied by the grammar, but within those constraints it may perform the additions in any order. To force an order of evaluation (in Standard C), you must use parentheses.