On 8/21/06, Alexander Belopolsky <[EMAIL PROTECTED]> wrote:
GCC on a LP64 machine does not generate warnings for the above code. It doesn't have anything to do with 64-bit or 32-bit anyway, since Py_ssize_t and size_t are supposed to be the same size. They just different in signedness, and that's the case on any system. Even if those functions were defined to return longs instead of Py_ssize_t's, GCC wouldn't generate a warning; it's a valid (implicit) downcast that might lose bits. I believe there's a Windows compiler that goes warn for such cases, but if so, I'm sure it generates a whole lot of spurious ones at the moment.
There are also cases of implicit casts like this that were not
caught so far:
static Py_ssize_t
mmap_buffer_getreadbuf(mmap_object *self, Py_ssize_t index, const
void **ptr)
{
...
return self->size;
}
static Py_ssize_t
mmap_buffer_getwritebuf(mmap_object *self, Py_ssize_t index, const
void **ptr)
{
...
return self->size;
}
I don't have any system with sizeof(size_t) != sizeof(long), but it
maybe worth the effort to review the warnings on such system.
GCC on a LP64 machine does not generate warnings for the above code. It doesn't have anything to do with 64-bit or 32-bit anyway, since Py_ssize_t and size_t are supposed to be the same size. They just different in signedness, and that's the case on any system. Even if those functions were defined to return longs instead of Py_ssize_t's, GCC wouldn't generate a warning; it's a valid (implicit) downcast that might lose bits. I believe there's a Windows compiler that goes warn for such cases, but if so, I'm sure it generates a whole lot of spurious ones at the moment.
--
Thomas Wouters <[EMAIL PROTECTED]>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com