This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C++ Bug or (my) Interpretation error
- From: me22 <me22 dot ca at gmail dot com>
- To: aschwarz1309 at verizon dot net
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 14 Sep 2008 16:04:56 -0400
- Subject: Re: C++ Bug or (my) Interpretation error
- References: <220664.92395.qm@web84008.mail.mud.yahoo.com>
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.