You refer to question C. However, this does not matter, since C and C ++ are different languages.
In addition, sequence points no longer exist with C11 and C ++ 11; instead, there are relationships sequenced to, unclassified and vaguely ordered.
In this quote:
- assignment means writing to memory
a . - computing the value of an expression means computing the value of this expression. (Example - a
2 + 2 value is 4 , and calculating a value is the process of determining that 4 was a value).
There are two calculations of the values: a ^ b and a = (this result).
In the cited text for a = a ^ b everything should happen in the following order:
Extract values โโfrom a and b (in any order) and determine the location of the memory where the result will be stored (calculation of the value of the right and left operand, respectively)
Save the result to a (assignment). It involves calculating the value a ^ b , which is not mentioned in the quote, but explicitly the result must be calculated before it is saved.
Calculate the value of the assignment expression. This means that the value stored in a is ready to use the surrounding expression (evaluating the value).
You are right that 2 and 3 seem to be โbackwardโ compared to what you can do on paper. But remember that in general y differs from x = y . The value of the assignment expression matches the value stored in x . (Example: int x; double y = (x = 6.5); - then y is 6 , not 6.5 ). So we can do this by storing the result in a , and then suggesting a as the result.
source share