switch_type

switch_type(switch-type-specifier)

switch-type-specifier
Specifies an integer, character, boolean, or enum type, or an identifier of such a type.

Examples

typedef [switch_type(short)] union _WILLIE_UNION_TYPE { 
    [case(24)] 
        float fMays; 
    [case(25)] 
        double dMcCovey; 
    [default] 
        ; 
} WILLIE_UNION_TYPE; 
 
typedef struct _WINNER_TYPE { 
    [switch_is(sUniformNumber)] WILLIE_UNION_TYPE w; 
    short sUniformNumber; 
} WINNER_TYPE; 
 

Remarks

The switch_type attribute identifies the type of the variable used as the union discriminant. The switch type can be an integer, character, boolean, or enum type.

The switch_is attribute specifies the name of the parameter that is the union discriminant. The switch_is attribute applies to parameters or members of structures or unions.

The union and its discriminant must be specified at the same logical level. When the union is a parameter, the union discriminant must be another parameter. When the union is a field of a structure, the discriminant must be another field of the structure at the same level as the union field.

See Also

encapsulated_union, IDL, non-encapsulated_union, switch_is, union