[issue10044] small int optimization

Antoine Pitrou report at bugs.python.org
Thu Oct 7 21:30:55 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> 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]

I can't say anything about the standard, but p > q looks like it should
be the same as (p - q) > 0, which looks rather well-defined for
pointers.

(at worse we could cast to _Py_uintptr_t, hopefully the compiler
wouldn't produce any different code)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10044>
_______________________________________


More information about the Python-bugs-list mailing list