Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!xanth!mcnc!duke!romeo!drh From: drh@romeo.cs.duke.edu (D. Richard Hipp) Newsgroups: comp.lang.c Subject: Re: () ignored in some expressions Message-ID: <18833@duke.cs.duke.edu> Date: 10 Apr 90 13:03:30 GMT References: <48079@lanl.gov> <101287@convex.convex.com> Sender: news@duke.cs.duke.edu Reply-To: drh@duke.cs.edu Organization: Duke University CS Dept.; Durham, NC Lines: 13 >In MOST cases this [Ignoring ()] >is not a problem with INTEGER math, but it is a BIG problem with >floating point numbers. I often what to do things like increase an integer by 50%. This can be done as follows: i = (i*3)/2; If an optimizing compiler can ignore the parenthesis, then it will probably notice that it can evaluate 3/2 at compile time to 1. It will then notice that a multiplication by 1 can be ignored. The end result is that my optimizing compiler will decide not to generate any code at all for the above statement. According to K&R, the only way to avoid this disaster is to code the operation in two steps: i *= 3; i /= 2;