[LLVMdev] Why "I = ++I" instead of "++I" in COFFDump.cpp ?
Joerg Sonnenberger
joerg at britannica.bec.de
Mon Apr 7 12:09:57 PDT 2014
On Mon, Apr 07, 2014 at 08:38:58AM -0600, Richard wrote:
> Oops, meant to send this to the mailing list instead of to Reid
> privately. (Why cc the mailing list instead of just sending to the
> mailing list?)
>
> In article <CACs=tyJ6zaHeiS0eNhBkdcZE--JY4k7yH9_P1yFbGqod6uymMw at mail.gmail.com>,
> Reid Kleckner <rnk at google.com> writes:
>
> > Looks like a bug. This can probably be simplified with C++11.
> >
> > On Fri, Apr 4, 2014 at 10:39 AM, Robison, Arch <arch.robison at intel.com>wrote:
> >
> > > for (; I != E; I = ++I) {
> > > ...
> > > }
> > >
> > > Is there a reason for writing "I = ++I" instead of "++I" ?
>
> I don't see how it's a bug because functionality isn't impacted by
> this. It's simply a redundant assignment.
It is a bug as it violates the sequence point rule. One memory location
shall not be modified twice.
Joerg
More information about the llvm-dev
mailing list