Efficiency Question

Checkpoint Technologies ckp at grebyn.com
Wed Feb 27 15:46:08 AEST 1991


In article <17112 at crdgw1.crd.ge.com> volpe at 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!             \/



More information about the Comp.lang.c mailing list