Talk:Operators in C and C++: Difference between revisions

Content deleted Content added
GIrving (talk | contribs)
Mention that the table entry for ?: is wrong
Line 179:
 
and the conditional expression cannot match to "unary-expression." Most compilers (especially with recursive-descent parsers) modify the grammar by replacing "unary-expression" with "conditional-expression" to avoid back-tracking or look-ahead or to handle errors gracefully, and thereof the syntactic error turns into a semantic one saying that the left operand of "=" or "op=" should be an lvalue. Which is why many people mistake the error for the semantic error. --[[User:Woong.jun|Woong.jun]] ([[User talk:Woong.jun|talk]]) 11:43, 15 March 2010 (UTC)
 
In C++, it is clearly incorrect to simply list ?: has having higher precedence than =. For example, the statement "1 ? a : b = 7;" does nothing, in clear violation of the table. Thus, the table should be changed at least to clearly state that the situation is more complex. Is it sufficient to say that ?: and assignment have the same precedence, and both associate right to left? [[User:GIrving|GIrving]] ([[User talk:GIrving|talk]]) 22:33, 10 September 2012 (UTC)
 
== Adding links ==