Sturla Molden wrote:
> On 4/19/2009 10:50 PM, Dag Sverre Seljebotn wrote:
>
>> Could we have some kind of keyword to define packed structs in Cython?
>> This is not part of the C standard, but is supported in most C compilers
>> through extensions.
>
> Since it's not in the standard, there is no standard syntax for this.
>
> But you can fake it using a char array and some constants storing offsets.

Thanks, good idea. Indeed, since Cython would know the struct definitions,
we could just directly output the necesarry pointer arithmetic :-)

However using the various compiler extensions would take less time to
implement in Cython and make for more readable code. I'm not that worried
about compatability -- we're only considering the subset of C compilers on
which CPython compiles anyway, and it's a fairly universal compiler
extension (though with differing syntax).

So (assuming a positive vote on this) I suppose I'll go that route first,
and then take your approach if there's a need.

Dag Sverre

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

Reply via email to