|
|
|
|
|
by kazinator
41 days ago
|
|
There is a possibility that the two increments, as well as the assignment, happen in parallel, and conflict at the bit level, resulting in a value that is neither a + 1, nor a + 2. (When I say "possibility", I meant that it would not be nonconforming, not that I have in mind a specific implementation where such a result can be reproduced.) A side-effected object may be modified at most once in one evaluation phase. But this problem already occurs in something simpler like: b = a++ + a
where the problem is that a modified object is observed by a subexpression in the same evaluation phase, but that subexpression is independent of the side effect.If a is updated in some piecewise, non-atomic way, then it's possible that the right side of the + obtains a half-baked snapshot. Say that a is unsigned and wraps from FF..FF to 00..00, but say this happens byte by byte. The right side of the assignment could access a torn value like FF..00. |
|