Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
x=(x=5,11)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Old Wolf, post: 2466834"] Correct. But the evaluation of the left-hand operand of the assignment operator does not cause the value of x to be read or written, so it does not fall foul of the rule about UB due to multiple reads/writes between sequence points. I didn't mention this as it is a red herring compared to the main issue. However, this code would certainly be undefined, for the reason you mention: *p = (p = q, 11); where p and q are valid pointers to int. The evaluation of an operator's operands, does not mean that the evaluation of the operator has started. In fact, my lemma is that the assignment operator cannot be evaluated until its right-hand operand has been evaluated (although the left hand one may be evaluated at any time). Note that 'evaluating' the left hand operand of the assignment operator means determining the adddress at which the value will be stored (it doesn't mean reading or writing that value). Yes, x is modified twice between sequence points. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
x=(x=5,11)
Top