[Cython] a problem with sizeof() return type
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Wed Feb 4 00:30:15 CET 2009
Michael Abshoff wrote:
> Jason Evans wrote:
>> cdef extern from "sys/types.h":
>> ctypedef unsigned long size_t
>
>
> Well, make it unsigned long long on 64 bit Windows and it ought to work
> nearly everywhere. I am not aware of any LLP64 bit OS that Cython
> supports besides 64 bit Windows. Obviously there is no sys/types.h on
> Windows, but that is a different story :)
Just a slightly related note:
Note that with this kind of declaration, all Cython uses in 90% of the
situations is the fact that it is an unsigned integral type. "unsigned
char size_t" it will do the same in almost all situations -- in the end,
"size_t" is simply emitted to the .c file.
The 10% is overflow exceptions from coercion from Python integer -- and
pushing that decision too to the C compiler is on my personal todo-list
(though far down). In general Cython prefers to leave knowledge of the
size/capacity of types to the C compiler.
--
Dag Sverre
More information about the Cython-dev
mailing list