On 9 Jul 2013, at 05:40, Tim Kientzle <tim_at_kientzle.com> wrote: > However, this does have an implicit redundant store, > so changing it to > > ptr = func(ptr + 1); > > is still a good idea, just not for the reason Clang was claiming. If the compiler can tell that ptr has not escaped, then it will elide the redundant store (typically, it will be gone as long as ptr is a local and its address has not been passed out of the function), so there should be no change to the generated code. However, I still agree that it is good style, because if I read the original code I would be left wondering what the original programmer expected the incremented value of ptr++ to be visible to and suspect a more subtle error. David
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC