difference between c++; and ++c;

Joe English jeenglis at alcor.usc.edu
Mon Apr 22 02:59:10 AEST 1991


berry at arcturus.uucp (Berry;Craig D.) writes:
>bhoughto at nevin.intel.com (Blair P. Houghton) writes:
>>    i += 1;   "Increment i."

>No, "Increment i then discard the resulting value."  Could it be that you
>have forgotten that += is an operator, returning the new lhs rvalue?  

"Discard the resulting value" is a no-op.  It's equivalent
to "fail to use the resulting value in any subsequent calculations",
which is implicitly stated in that the value isn't used again.
I might read 

       (void)(i += 1);

as "add one to i, then discard the resulting value" but in

       i += 1;
    
there's no explicit "discard", and talking about the implicit
one doesn't really help to illustrate the semantics.


This is getting silly...


--Joe English

  jeenglis at alcor.usc.edu



More information about the Comp.lang.c mailing list