> why does being able to switch on any enum trump
> the ability to define constants without #define?

Because enum's legacy is that of a 'first class' int-like
object, which can be subject to the usual set of int-like
operations. switch() is one of those. #define isn't.

> if you try, sizeof(foo)==4, but you'll need to remove
> 'd' since you can't have a string.  you can't switch on
> a vlong or float.  would be nice, though.

Why not a string? If you can extend an enum to include floats,
why not an integer representation of a pointer?

And yes, I also think switching on vlongs would be useful.

> the plan 9 style is never to typedef or name enums.

It may not be the style for the Labs, but that's not the case for
everyone.  The compile time type checking named enums provide isn't
something I'd want to lose.

> if it were an error to name or typedef an enum
> containing non-int members, there would be no
> problem.

This could work. But I have to agree with Bakul: 'static const'
is a much better fit for the language.

--lyndon


Reply via email to