Ask Your Question
0

Does Cython support type names from inttypes.h?

asked 2010-08-23 07:42:03 -0500

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
1

answered 2010-08-23 08:40:16 -0500

Mike Hansen gravatar image

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

%cython

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

Stats

Asked: 2010-08-23 07:42:03 -0500

Seen: 411 times

Last updated: Aug 23 '10