Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!samsung!think!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: () ignored in some expressions Message-ID: <16426@haddock.ima.isc.com> Date: 10 Apr 90 18:56:48 GMT References: <48079@lanl.gov> <101287@convex.convex.com> <18833@duke.cs.duke.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 12 In article <18833@duke.cs.duke.edu> drh@duke.cs.edu writes: >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 [reduce this to a no-op] Yeah, right. And it will change "(x+1)*(x+1)" to "x + 1*x + 1", which isn't what I wanted! Horrors! Seriously, folks, this is *not* what K&R 1 said. "i = (i*3)/2" has always been safe from this type of optimization. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint