compiler errors - C: Why can't you increment/decrement a variable twice in the same expression? -
when try compile code
int main() { int = 0; ++(++i); }
i error message.
test.c:3:5: error: lvalue required increment operand ++(++i); ^
what error message saying? gets picked parser, or discovered during semantic analysis?
++i
give rvalue1 after evaluation , can't apply ++
on rvalue.
§6.5.3.1 (p1):
the operand of prefix increment or decrement operator shall have atomic, qualified, or unqualified real or pointer type, , shall modifiable lvalue.
1. called "rvalue" in international standard described "value of expression". - §6.3.2.1 footnote 64).
Comments
Post a Comment