-
Notifications
You must be signed in to change notification settings - Fork 794
Closed as not planned
Description
In some Chinese C++ textbooks (For example: Tan Haoqiang C programming), there are often exercises like the following:
#include <iostream>
int main(){
int i = 1;
std::cout << (i++)+(++i) << endl;
}
The textbook provides the answer as 6
, but when compiled with G++, the output is 4
or 5
or 6
(Depends on level of optimization).
I want to have some specification for this operation, such as:In the same row, if the variable has been increment more than once, the value before the first increment of the variable is used as the reference value.
Thanks.
JankieQwQcpplearner, WAAutoMaton, 0x24a, ZeroOf149 and LongLiveGPCR
Metadata
Metadata
Assignees
Labels
No labels