enum

This statement defines a C-style enumerated type.

Syntax

typedef [attributes] enum [tag] {
    enumlist
} enumname;

Syntax Elements

attributes
The helpstring, helpcontext, hidden, and uuid attributes are accepted before an enum statement. The helpstring and helpcontext attributes are accepted on an enumeration element. For more information about the attributes accepted before an enumeration definition, see "Attribute Descriptions" earlier in this chapter. Attributes (including the brackets) can be omitted. If uuid is omitted, the enumeration is not uniquely specified in the system.
tag
An optional tag, as with a C enum.
enumlist
List of enumerated elements.
enumname
Name by which the enumeration is known in the type library.

Comments

The enum keyword must be preceded by typedef. The enumeration description must precede other references to the enumeration in the library. If value is not specified for enumerators, the numbering progresses, as with enumerations in C. The type of the enum element is int, the system default integer, which depends on the target type library specification.

Examples

typedef [uuid(DEADF00D-C0DE-B1FF-F001-A100FF001ED),
        helpstring("Farm Animals are friendly"), helpcontext(234)]
enum {
    [helpstring("Moo")] cows = 1,
    pigs = 2
} ANIMALS;