◐ Shell
clean mode source ↗

Message 118142 - Python tracker

> How is the compiler supposed to know whether a and b belong to the same
> array when compiling ptr_compare?

It doesn't need to know.  So long as the compiler can guarantee that its code will produce correct results in the case that a and b *do* both point to the same array, that's enough.  In other words, when producing code for ptr_compare, the compiler is allowed to *assume* that a and b point into the same array, and act accordingly.