Is there any difference in Cython between allocating memory like this
from libc.stdlib cimport malloc
cdef int *ar = <int *>malloc(100 * sizeof(int))
and like this
from libc.stdlib cimport malloc
ar = <int *>malloc(100 * sizeof(int))
No difference. The latter just relies on Cython's ability to deduce the type of ar, which should be pretty easy in this case. If the type deduction fails then you'd get an error message at the cythonizing stage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With