这是来自于C++ Primer 5th的练习题:
代码如下:Exercise 4.33: Explain what the following expression does(Page158): someValue ? ++x, ++y : --x, --y
bool someVlaue = 1;
int x = 0;
int y = 0;
someVlaue ? ++x, ++y : --x,--y;
std::cout << x << std::endl << y << std::endl;
我尝试了 Gcc4.81
和 Clang3.5
,但两者都给我以下结果:
1
0
Press <RETURN> to close this window...
为什么不能是
1
和1
呢?有人能解释一下它被如何解释吗?