[Pyrex] Initialisation of cdef global arrays with constants [resend]

Yann Vernier yann at donkey.dyndns.org
Sat Jan 8 00:01:15 CET 2005


On Sat, Jan 08, 2005 at 07:01:21AM +1100, sjmachin at lexicon.net wrote:
> Pyrex appears not to support (yet?) a statement like:
> 
> cdef int blah_table[5] = {0, 1, 2, 42, 255}

> Any better suggestions?

I would like to see this implemented. I'd suggest the Python style
syntax using parenthesis and not curly braces, so it won't look like
you're building a broken dictionary. 

cdef int blah_table[5] = (0, 1, 2, 42, 255)

I'd also like to support unsized arrays:

cdef int blah_table[] = (0, 1, 2, 42, 255)

And this may make sense in structs and such too, where pyrex doesn't
need the size at compile time. If need be, the C compiler can get you
the size using an ugly application of sizeof.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20050108/b22ed28f/attachment.bin


More information about the Pyrex mailing list