Tim Rentsch wrote in news: snipped-for-privacy@alumnus.caltech.edu:
[snip]I'll make one more attempt at explaining why I don't think that's a natural reading of the text. If you read and parse the tokens of the statement "x = a + b + c + d;" against the grammar given in section A.2 of the standard, they are matched against the rules specified in the grammar. The full list of the productions matched for this expression is given below (I've tried to use indentation to show the production boundaries). There are a large number of expressions that must be "reduced" in parsing this one statement.
01 statement 02 expression-statement 03 expression v 04 assignment-expression v 05 unary-expression 06 postfix-expression 07 primary-expression 08 identifier('x') 09 assignment-operator 10 '=' 11 assignment-expression v 12 logical-OR-expression v 13 logical-AND-expression v 14 inclusive-OR-expression v 15 exclusive-OR-expression v 16 AND-expression v 17 equality-expression v 18 relational-expression v 19 shift-expression v 20 additive-expression v 21 additive-expression 22 additive-expression 23 additive-expression 24 multiplicative-expression 25 cast-expression 26 unary-expression 27 postfix-expression 28 primary-expression 29 identifier('a') 30 '+' 31 multiplicative-expression 32 cast-expression 33 unary-expression 34 postfix-expression 35 primary-expression 36 identifier('b') 37 '+' 38 multiplicative-expression 39 cast-expression 40 unary-expression 41 postfix-expression 42 primary-expression 43 identifier('c') 44 '+' 45 multiplicative-expression v 46 cast-expression v 47 unary-expression v 48 postfix-expression v 49 primary-expression v 50 identifier('v')=> *volatile*The "volatile object" is introduced via the evaluation of the primary- expression at lines 49-50 and flows up to other encompassing expressions from there; that is, the primary expression at 49 refers to a volatile object and, by extension, anything that depends on its evaluation also refers to a volatile object. By the same token, expressions on other non-dependent branches of the parse tree cannot be said to refer to a volatile object. In the list above, I've appended a "v" to the line for each expression that "refers to" a volatile object.
Now, the 'additive-expression' beginning at line 21 and running through line 43 represents the sub-expression "((a + b) + c)". None of the expressions within this range "refer to" a volatile object.
(Nor, interestingly, does the unary-expression representing the left- hand side of the assignment at lines 5-8, though the assignment- expression itself still does.)
I believe this interpretation is completely consistent with the standard's text "any expression referring to..."
'x = ' is an "assignment expression". See section 6.5.16.
I concede that would not be the right thing (since "full expression" is explicitly defined as *not* being part of a declarator). However, I wasn't arguing that they *should have* used the term "full expression"; my real point was that the breadth implied by "full expression" cannot be assumed.
GH