다음을 통해 공유


enum

This statement defines a C-style enumerated type.

Syntax

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

attributes

The helpstring, helpcontext, hidden, uuid, and version attributes are accepted before an enum statement. The helpstring and helpcontext attributes are accepted on an enumeration element. Attributes (including the brackets) can be omitted. If uuid is omitted, the enumeration is not uniquely specified in the system.

tag

An optional tag.

enumlist

The list of enumerated elements.

enumname

The name by which the enumeration is known in the type library.

Remarks

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.

Example

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