On Nov 22, 2008, at 11:08 PM, Tim Wakeham wrote:

> Ok, I've done a bit of testing and the problem seems to be in  
> recursive
> ctypedef's.
>
> Eg.
>
> ctypedef struct foo:
>       int count
>       foo *bar
>
> causes the bug in the outputted code.  Remove the reference to  
> itself and
> the problem goes away.
>
> cdef struct foo:
>       int count
>       foo *bar
>
> compiles fine.  I'm guessing that even if a recursive type def isn't
> allowed, then the cython
> translator should complain about it before gcc is ever invoked.

I consider it a bug anytime Cython emits invalid C. One should never  
have to see gcc errors (assuming, of course, that all the external  
declarations are made correctly). We should either throw an error or  
separate out the typedef. http://trac.cython.org/cython_trac/ticket/136

> The easy
> way around it is to
> do the C thing and do a plain cdef first, then do the ctypedef like
>
> cdef struct foo:
>       int count
>       foo *bar
>
> ctypedef foo FOO
>
> Hope this helps.

Very much so. Thanks.

- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to