[Pyrex] enum regression 0.9.5?
Anders Gustafsson
andersg at 0x63.nu
Mon Jan 29 13:12:01 UTC 2007
Greg Ewing wrote:
> That looks like it'll make any two enum types compatible,
> which doesn't sound right. I'll look into this.
I'm not a C++ expert. But I think the enums are implicitly converted to
ints making it legal C++. Maybe it might be a good idea to allow pyrex
to be stricter in this case, as comparing variables of two different
enums is most probably is a bug.
But I think that it might be a good idea to allow comparation of ints
and enums.
With:
cdef myenum_t y
I think these should be valid:
if y == 10
if y < 10
And I would definitly expect this to work:
cdef extern from "whatever.h":
ctypedef enum enum_t:
ENUM_VAL1
ENUM_VAL2
ENUM_END
def x(int i):
if i >= ENUM_END:
raise
do_stuff(i)
anders
More information about the Pyrex
mailing list