On 12/24/2016 2:28 AM, Johan Engelen wrote:
Of course, but it's not codified in the source and thus the function is
different from the foreach version.

More importantly, I think it is broken. I find it very hard to reason about the
ptrdiff_t version, because of all the potential overflows and the mixing of
unsigned and signed math.

You are pedantically correct. It's possible someone would write a bizarre loop, and compiler optimizers need to take that into account when doing loop transformations.

This is one of the reasons why D's array syntax and semantics is superior - it guarantees no overflow.

Reply via email to