> On 1 Feb 2020, at 00:36, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> 
> On 1/02/20 12:25 am, John Skaller2 wrote:
>> cdef extern from "Python.h":
>>     ctypedef int int32_t
>>     ctypedef int int64_t
>>     ctypedef unsigned int uint32_t
>>     ctypedef unsigned int uint64_t
> 
> These work because Cython doesn't need to know the exact
> sizes of these types. All it needs to know is that they're
> some kind of integer so that its type checks will pass.
> The typedef names end up in the generated C code, and the
> C compiler figures out their actual sizes.

Ah. I see. That makes sense. So this is some kind of hack way
of getting something a bit like Haskell type classes,
you’re basically saying int32_t and int64_t are of class “Integer”.

This also explains the conflict for me, because Felix is the opposite:
it aims to make the types of things more precise (and has actual
type classes for generalisation).
—
John Skaller
skal...@internode.on.net





_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to