Michael Abshoff wrote:
> Lisandro Dalcin wrote:
>> Cython treats sizeof() as if it returns 'int', but IMHO it should be 
>> 'size_t'.
> 
> Well, you might be technically correct since that is what the C standard 
> asks for, but according to various literature, i.e. for example
> 
> http://publications.gbdirect.co.uk/c_book/chapter5/sizeof_and_malloc.html
> 
> "The sizeof operator returns the size in bytes of its operand. Whether 
> the result of sizeof is unsigned int or unsigned long is implementation 
> defined—which is why the declaration of malloc above ducked the issue by 
> omitting any parameter information; "

That book appears to have been published in 1991...

Personally, I've found the lack of native size_t knowledge in Cython to 
be a major pain.  In practice though, the following is sufficient for 
every modern system I know of, with the likely exception of Windows:

     cdef extern from "sys/types.h":
         ctypedef unsigned long size_t

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

Reply via email to