DISCLAIMER: This is not a real-world example. It is just a theoretical question of how these languages work.
C/C++、C#和Java在post&;增量前操作符?
这就是我从VC++10、Java 1.6和C#4中得到的
int a = 2;
int b = a++ + a++;
int c = ++a + a++ + a++;
+-----+------+------+----+
| C | C++ | Java | C# |
+-----+-----+------+------+----+
| a | 7 | 7 | 7 | 7 |
+-----+-----+------+------+----+
| b | 4 | 4 | 5 | 5 |
+-----+-----+------+------+----+
| c | 15 | 15 | 16 | 16 |
+-----+-----+------+------+----+