How many expr_no_commas '=' expr_no_commas expressions are there in C?
expr_no_commas '=' expr_no_commas
It's found in C's rule,but the only possible form I 开发者_StackOverflowcan think of is:
identifier = expr_no_commas
that is,the left side is a single variable,any other variants?
There a lot of C expressions that are assignments to non-identifiers; here are a few examples:
x[1] = 5;
*f() = 7;
*p++ = 0;
a[i].f = a[i].g;
Where did you find that "rule"? The syntax presented in the language standard (draft n1256, § 6.5.16) is
assignment-expression:
conditional-expression
unary-expression assignment-operator assignment-expression
assignment-operator: one of
= *= /= %= += -= >= &= ^= |=
where unary-expression results in any number of productions that aren't simple identifiers (as Jeremiah Willcock has shown).
精彩评论