Message119020
On Mon, Oct 18, 2010 at 9:59 AM, Antoine Pitrou <report@bugs.python.org> wrote:
..
>> Why? As far as I can tell, negative values are only used as sentinels
>> and we can use say (size_t)-1 instead of -1L.
>
> You can, except that changing the sentinel value will probably break a
> lot of code out there (and there's no benefit AFAICT).
AFAICT, a change from (Py_ssize_t)-1 to (size_t)-1 is less likely to
break code than a change from -1L to (Py_ssize_t)-1. (Assuming a
sizeof(long) != sizeof(void*) platform.) The benefit, though is that
hash computations can be performed natively on the hash values without
casting to an unrelated type. If Py_hash_t needs to be signed, I
would like to see a typedef Py_uhash_t size_t next to that for
Py_hash_t and Py_uhash_t used in hash computations rather than
explicit size_t. |
|
Date |
User |
Action |
Args |
2010-10-18 14:09:12 | belopolsky | set | recipients:
+ belopolsky, lemburg, tim.peters, loewis, skip.montanaro, georg.brandl, rhettinger, jimjjewett, mark.dickinson, pitrou, casevh, ked-tao, benjamin.peterson |
2010-10-18 14:09:11 | belopolsky | link | issue9778 messages |
2010-10-18 14:09:10 | belopolsky | create | |
|