There is a rule about sequence point that goes like this.
"Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored."
What bugs me is the last sentence.
In the case of
a=c++;
the object whose value is getting modified is 'c'; the value of c is getting incremented. But, the old value of c is being passed to a, when the rule says that the prior value of c should only be used for determining the value to be stored in c (in this case, it should only be used for incrementing c) not for any other purpose. How is it that the old value is being used for another purpose
These cases are common, as there are often expressions of the form : [code=c] d=e/c++;
where the prior value of c is being used as the divisor of e.[code=c] a=c++;
the object whose value is getting modified is 'c'; the value of c is getting incremented. But, the old value of c is being passed to a, when the rule says that the prior value of c should only be used for determining the value to be stored in c (in this case, it should only be used for incrementing c) not for any other purpose. How is it that the old value is being used for another purpose
These cases are common, as there are often expressions of the form :
d=e/c++;
where the prior value of c is being used as the divisor of e.[code=c] d=e/c++;
where the prior value of c is being used as the divisor of e.