[Pyrex] More on enums in 0.9.5.1a

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 7 23:34:50 UTC 2007


Lenard Lindstrom wrote:
> I can only suggest the following. A pointer
> represents an open range of values limited only by the hardware.

Not really -- strictly speaking, it's only *supposed*
to point somewhere into a valid, existing array. Most C
compilers don't bother generating code to check that,
though (and it would be difficult to do, considering
the wide variety of things that can constitute a valid
array, such as malloced memory).

Likewise, an enum is only *supposed* to hold a certain
range of values, but nobody would blame the compiler for
not enforcing that.

> Of course C++ is too low level a language to support succ() and prec() 
> operations directly. It might have to generate an entire switch 
> statement implicitly!

I'd be happy if it were only defined on enums with
congiguous values. If you use it any other way, you're
on your own, as with most things in C.

> One has to justify templates and classes 
> somehow.

Yeah, I guess so. :-)

--
Greg



More information about the Pyrex mailing list