[Cython] Recursive structure, typedef

Robert Bradshaw robertwb at math.washington.edu
Tue Dec 2 06:07:49 CET 2008


On Dec 1, 2008, at 3:27 PM, Greg Ewing wrote:

> David Cournapeau wrote:
>
>> Notice how the recursive is referenced through a typedef. In C, this
>> is solved by forward declaring the struct through a typedef before  
>> the
>> struct declaration. But AFAIK, you can't do that in cython.
>
> Not sure about Cython, but the following works in Pyrex:
>
>    cdef struct foo
>
>    ctypedef foo foo_t
>
>    cdef struct foo:
>      foo_t *f

Yes, this works in Cython too.

- Robert



More information about the Cython-dev mailing list