Weird behaviour of prefix and postfix operators
问题 Why is the first expression allowed, but the second not: void test() { int a; ++a = getSomeInt(); a++ = getSomeInt(); } I mean, why its forbidden for the second one to be an lvalue ? The second one makes sense and the first not. In the first one we increment the variable and immediately after we gave here a new value, we lose it. That's not the case in the second expression. It makes sense to assign some value and increment the variable after that. 回答1: The result of postfix increment is