[Pyrex] enum regression 0.9.5?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jan 30 00:36:05 UTC 2007


Anders Gustafsson wrote:
> 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++.

I just tried an experiment, and it seems that gcc regards it
as legal but worthy of a warning:

   foo.cc: In function `void foo()':
   foo.cc:7: warning: comparison between `enum E' and `enum F'

This means that I probably ought to disallow it in Pyrex,
because I'm trying to generate warning-free code.

> comparing variables of two different
> enums is most probably is a bug.

I'm inclined to agree.

> But I think that it might be a good idea to allow comparation of ints
> and enums.

Yes, and gcc seems quite happy with that, too.

--
Greg



More information about the Pyrex mailing list