I’m looking for some clarification for the emphasised line.
(C99 6.5.16/3) An assignment operator stores a value in the object
designated by the left operand. An assignment expression has the value
of the left operand after the assignment, but is not an lvalue. The
type of an assignment expression is the type of the left operand
unless the left operand has qualified type, in which case it is the
unqualified version of the type of the left operand. The side effect
of updating the stored value of the left operand shall occur between
the previous and the next sequence point.
Consider the following example:
int x = 42;
int y = 0;
int main()
{
// side effect of modifying 'x'
x = y;
}
What are the previous and next sequence point? Is there a sequence point at the start of main?
C99 5.1.2.3 defines sequence points as the places by which all side effects of the previous evaluations have taken place and the side effect of subsequent evaluations have not yet started taking place. The annex C of the standard defines the places where the sequence points take place: function calls, end of logical operators, the comma operator, and the ternary operator, end of a full declarations, end of a full expression, and so on.
In this case, the previous sequence point is the start of
main(), and the next sequence point is the semicolon at the end of the assignment. At the first sequence point,xwill have a value of 42, and at the second one, it will be 0.