Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!haven!grebyn!ckp From: ckp@grebyn.com (Checkpoint Technologies) Newsgroups: comp.lang.c Subject: Re: () ignored in some expressions Message-ID: <19540@grebyn.com> Date: 9 Apr 90 19:13:29 GMT References: <48079@lanl.gov> Reply-To: ckp@grebyn.UUCP (Checkpoint Technologies) Organization: Grebyn Timesharing, Vienna, VA, USA Lines: 18 In article <48079@lanl.gov> u096000@lanl.gov (Roger A. Cole) writes: >In K&R1, expressions involving one of the associative and commutative >operators can be arranged even when parenthesized. > >From the first time I read this, I've had difficulty not throwing up in >instances where this applies. I might be able to accept this *feature* >a little more peacefully if someone could explain the basis for it. > >Is this feature also present in ANSI standard C? This feature is modified in ANSI C. It now states that the results of expressions will be the answer as if parentheses had been honored. The compiler is still free to rearrange the expression, but only if the actions taken are always guaranteed to get the exact same answer in all cases as if the parentheses had been honored. In most cases this means that yes, the compiler will actually perform the operations in the order specified by the parentheses. This does not apply to side effects; their order is still undefined.