First time here? Check out the FAQ!

Ask Your Question
0

Does Cython support type names from inttypes.h?

asked 14 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 14 years ago

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;
Preview: (hide)
link

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: 14 years ago

Seen: 883 times

Last updated: Aug 23 '10