16-07-2008, 07:01 PM
Dave Wrote:Is there a function to get how many items are in an enum?
Nope. Most languages do not have this without some form of reflection / metacoding.
Also, Enums are, in most languages (I believe), a collection of constants. The only difference between:
Code:
enum X
a = 1
b = 2
c = 3
end enum
and
Code:
X_a = 1
X_b = 2
X_c = 3
is the forced relation between the elements in the enum and the intellisense. That way, if you specify an enum (instead of the underlying value of an enum which is usually the system's word size), you can show that only the given constants should be used for the input value.