Look at the following code:
int a = 1;
(++a)++;
If I write this code in C souce file, and use gcc to compile it, the result is that:
Increment operator needs lvalue
But if i write this code in c++ source file, use g++ compiler to compile it, there is no error. . According to 《C++ primer 5e》, prefix increment operator returns a lvalue.
So, ++a
is a lvalue, why (++a)++
is wrong?