Ask Your Question

Does Cython support type names from inttypes.h?

asked 2010-08-23 14:42:03 +0200

ccanonc gravatar image

I tried using int32_t or int64_t instead of long or long long, and it wouldn't compile.

What's the syntax sugar? Or are the explicit type names not allowed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-08-23 15:40:16 +0200

Mike Hansen gravatar image

For the intXX_t types, you can do something like the following:


cdef extern from "inttypes.h":
    ctypedef int int64_t  

def foo():
    cdef int64_t num = 10
    printf("num = %d\n", num)

If you look at the generated C code, you'll see something like this is generated:

#include "inttypes.h"
int64_t __pyx_v_num;
__pyx_v_num = 10;
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-08-23 14:42:03 +0200

Seen: 801 times

Last updated: Aug 23 '10