Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!uflorida!gatech!udel!haven!decuac!grebyn!ckp From: ckp@grebyn.com (Checkpoint Technologies) Newsgroups: comp.lang.c Subject: Re: Efficiency Question Message-ID: <1991Feb27.044608.28935@grebyn.com> Date: 27 Feb 91 04:46:08 GMT References: <1991Feb25.181434.6462@ux1.cso.uiuc.edu> <1991Feb26.042023.2097@grebyn.com> <17112@crdgw1.crd.ge.com> Organization: Grebyn Timesharing Lines: 18 In article <17112@crdgw1.crd.ge.com> volpe@camelback.crd.ge.com (Christopher R Volpe) writes: >Just wanted to point out that "x += 1" cannot be condensed to "x++", but >rather to "++x". Oh, be that way. :-) In the context you're quoting, both expressions are equivalent, but they aren't equivalent in all contexts. (But then, what is?) For example, you would be really concerned about this if you're converting "if (x += 1)" into "if (x++)", since they're not the same. You could however convert to "if (++x)". The two *statements* (not expressions) "x++;" and "++x;" are practically the same, since they have the side effect of incrementing x in common, and the result value is discarded. -- First comes the logo: C H E C K P O I N T T E C H N O L O G I E S / / \\ / / Then, the disclaimer: All expressed opinions are, indeed, opinions. \ / o Now for the witty part: I'm pink, therefore, I'm spam! \/