Pyrex, enumeration constants, and wrapping #define's

Greg Ewing (using news.cis.dfn.de) ckea25d02 at sneakemail.com
Tue Apr 8 00:13:29 EDT 2003


Edward C. Jones wrote:
> Does Pyrex accept the following?
> 
>     enum
>         a = 2
>         b = a + 3

Yes, if you change the "enum" to "cdef enum":

   cdef enum:
     a = 2
     b = a + 3

I just ran that through Pyrex 0.7 and it produced:

   enum  {
     a = 2,
     b = (a + 3),
   };

so, as long as your C compiler can cope with that,
all should be well.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list