R
Richard Tobin
$)CHarald van D )& k said:The relevant rules from the grammar are:
primary-expression:
( expression )
conditional-expression:
logical-OR-expression ? expression : conditional-expression
Assuming a is an expression, it is valid in both forms.
Yes. For it to break when the parenthesized version works, there
would have to be something that is parsable as an expression when
parenthesized, but not otherwise. All parentheses do is turn an
expression into a primary-expression, so if parentheses make it
an expression it already was one.
[We can see that parentheses are needed for the third operand, since
there *are* things that are parsable as a conditional-expression when
parenthesized, but not otherwise: a=b for example.]
-- Richard