C++ Bug or (my) Interpretation error

me22 me22.ca@gmail.com
Sun Sep 14 20:05:00 GMT 2008


On Sun, Sep 14, 2008 at 15:23, Arthur Schwarz <aschwarz1309@verizon.net> wrote:
>
> I would have expected that the last result would have been not equal. What seems to be happening is either the original 'num' is being compared to itself or the pre-increment 'num' is being compared to itself. At first blush, this appears wrong. Have I misunderstood the semantics?
>

My understanding is that all this is fundamentally UB, since you're
reading and updating values without a sequence point separating them.
It's the same sort of thing as why i = i++; is UB.



More information about the Gcc-help mailing list