[Pyrex] More on enums in 0.9.5.1a
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Feb 7 06:27:28 UTC 2007
Lenard Lindstrom wrote:
> That wouldn't be allowed because (e + 1) could be an invalid value for
> the enum.
Yes, I can see why, but it means that C++ enums
don't have any straightforward equivalent of Pascal's
pred() and succ() operations -- which is probably what
you're trying to do if you write e = e + 1.
This is an analogous issue to bounds checking of
array indices and pointer arithmetic, which C and
C++ are normally quite happy to not bother doing.
To suddenly get all paranoid when it comes to
enum ranges seems a bit inconsistent.
--
Greg
More information about the Pyrex
mailing list