Quote Originally Posted by LP Boy
...
Accordingly to the Standard this code leads to UB if i and j are integral types. But in given case there are two sequence points separating modification of the object in the operator++(). However, my compilator yields wrong result as if there is undefined behaviour. My conclusion was sequence points separate modifications of member of the object but modification of self object is not separated by sequence points. Nevertheless, I've found this explanation a bit suspect and I would like to know exact wording of what's happening.
...
Quote Originally Posted by LP Boy
...
According to the Standard this code leads to an UB if i and j are integral types. But in the given case there are two sequence points separating a modification of the object in the operator++(). However, my compiler produces a wrong result as if there is an undefined behaviour. My conclusion is that sequence points separate modifications of the object member but a modification of the object itself is not separated by sequence points. Nevertheless, I've found this explanation is a bit vague and I would like to know an exact cause of the problem.
...