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: 2466794"] The phrase "partial ordering" is not used by the Standard. Can you explain what you mean, and provide supporting quotes? The following quotes are relevant: C99 6.5.16#3 (Assignment operator) The side effect of updating the stored value of the left operand shall occur between the previous and the next sequence point. C99 6.5.17#2 The left operand of a comma operator is evaluated as a void expression; there is a sequence point after its evaluation. Then the right operand is evaluated; the result has its type and value C99 5.1.2.3#2 At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place. Old Wolf's lemma: The right operand of the assignment operator must be evaluated before the assignment operator's side-effect can take place. We are evaluating the expression (x = 5, 11). 6.5.17#2 says that there is a sequence point after (x=5) is evaluated and before "11" is evaluated. 5.1.2.3#2 and 6.5.16#3 both say that the side-effect of (x=5) must be complete before this sequence point. Old Wolf's lemma says that storing the result of (x=5, 11) in x must occur after (x=5,11) is evaluated. Therefore, according to 6.5.16#3 and 5.1.2.3#2, at the comma operator sequence point, x=5's side effect must be complete and x=11's side effect must not be complete. The only way you can deny this argument is to deny my lemma; so you are claiming that in the situation: x = (expression) the side-effect of updating x can occur before (expression) is evaluated. Agree? This is absurd. For example: x = 1; x = (printf("x is %d\n", x), 11); Do you still call this undefined and can it print 11? How about int f() { printf("x is %d\n", x); return 11; } ... x = 1; x = f(); How far can you draw your bow? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
x=(x=5,11)
Top