Den 22. aug. 2013 kl. 06:01 skrev Robert Bradshaw <rober...@gmail.com>:
> On Sat, Aug 17, 2013 at 3:31 AM, yi huang <yi.codepla...@gmail.com> wrote:
>> I use cython 0.19.1, when compile following code:
>>
>> cdef void some_function():
>> cdef char buf[sizeof(long)*8/3+6]
>>
>> Got error message:
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> cdef void some_function():
>> cdef char buf[sizeof(long)*8/3+6]
>> ^
>> ------------------------------------------------------------
>>
>> /tmp/test.pyx:2:17: Variable type 'char []' is incomplete
>
> That's an interesting one... it's a compile time value at C
> compilation time, but not a Cython compilation time. I don't have a
> quick fix.
>
That's an annoying error. I have never encountered it, but still it annoys me
:-(
A quick fix is to use alloca instead
cdef char *buf = alloca(sizeof(long)*8/3+6)
but beware that sizeof(buf) will be different.
Sturla
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel