[Python-Dev] A cast from Py_ssize_t to long
Alexander Belopolsky
alexander.belopolsky at gmail.com
Mon Aug 21 16:47:35 CEST 2006
On Aug 21, 2006, at 10:34 AM, Thomas Wouters wrote:
>
> Is there a simple automated way to detect situations like this? Maybe
> there is a win64 compiler that would generate a warning.
>
> I doubt it. Explicit casts are meant to silence warnings (among
> other things.) Warning for all casts is bound to generate quite a
> lot of warnings.
>
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.
More information about the Python-Dev
mailing list