On Feb 11, 2009, at 7:27 PM, Greg Ewing wrote:

> Robert Bradshaw wrote:
>> On Feb 11, 2009, at 12:47 PM, Lisandro Dalcin wrote:
>>
>>> cdef class A:
>>>   cdef readonly Py_ssize_t n
>>
>> People used to be able to write "ctypedef unsigned
>> long size_t" and have it work.
>
> Only if size_t is actually the size of an unsigned
> long on the platform concerned, though. Otherwise
> the Python runtime's idea of the struct layout won't
> match what is actually there.

What I meant was to use size_t one would write

cdef extern from *:
     ctypedef unsigned long size_t

which would work perfect as long as sizeof(unsigned long) == sizeof 
(size_t), and would also usually work fine if the sizes were  
different (if one never needed to pass to and from Python-land with a  
value large enough to care (though of course this is a bug waiting to  
happen)). Now that it's a builtin type, it broke the user being able  
to declare it, and we had to make sure to continue to support all use- 
cases.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to