◐ Shell
clean mode source ↗

Message 118121 - Python tracker

> I don't think arbitrary comparisons of pointers give well-defined
> results, unless those pointers both happen to point into the same
> array.  (Might be wrong;  I don't have a copy of the C standard to
> hand.)

Technically arbitrary relational comparisons of pointers are undefined, but in practice Antoine's assumptions here are very modest.  They boil down to:

   v >= &array[0] && v < &array[array_len]

It is hard for me to imagine a system designed such that the expression  could evaluate to true when v is not in the array.

I suppose a system could be designed where relational comparisons of unrelated data pointers causes a segmentation fault or similar, but that also seems unlikely to me.