Pyrex, enumeration constants, and wrapping #define's

Mike Rovner mike at bindkey.com
Mon Apr 7 17:10:30 EDT 2003


"Edward C. Jones" <edcjones at erols.com> wrote in message
news:b6soip$okk$1 at bob.news.rcn.net...
> Harbison and Steele ( 4th edition, Section 5.5) say that some C
> compilers will accept an enum where some constant expression is written
> in terms of a previously defined enumeration constant:
>
>      enum xx {
>          a = 2,
>          b = a + 3
>      }
>
> Does Pyrex accept the following?
>
>      enum
>          a = 2
>          b = a + 3
>

No ;)
Use that:
cdef enum xx:    a = 2    b = a+3AFAIR, Pyrex take expressions in enums
since v0.4

> If not, how should I wrap this?
>
>      #define IPL_DEPTH_SIGN 0x80000000
>      #define IPL_DEPTH_8S  (IPL_DEPTH_SIGN| 8)


IPL_DEPTH_SIGN=0x80000000
IPL_DEPTH_8S=(IPL_DEPTH_SIGN| 8)

Mike








More information about the Python-list mailing list