According to C ++ 17, there is no guarantee for the evaluation order in the following expression. This is called unspecified behavior.
int i = 0;
std::cout<<i<<i++<<std::endl;
C ++ 17 The GCC compiler gives the following warning: Live Demo
prog.cc: In function 'int main()':
prog.cc:6:20: warning: operation on 'i' may be undefined [-Wsequence-point]
std::cout<<i<<i++<<std::endl;
I don’t understand, in C ++ 17 above they express no longer undefined behavior, and then Why does the compiler give a warning about undefined?
source
share