문제

see simple example:

int a = 0;
int b = (a ++  ,  a + 1); // result of b is UB or well defined ?  (c++03).

This was changed in c++11/c++14 ?

도움이 되었습니까?

해결책

The result is well defined and has been since C++98. The comma operator introduces a sequence point (or a "sequenced before" relationship in later C++s) between the the write and the second read of a and I don't see any other potential reasons for undefined behavior.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top