switch

switch (switch-type switch-name)

switch-type
Specifies an int, char, enum type, or an identifier that resolves to one of these types.
switch-name
Specifies the name of the variable of type switch-type that acts as the union discriminant.

Examples

typedef union _S1_TYPE switch (long l1) U1_TYPE { 
    case 1024: 
        float f1; 
    case 2048: 
        double d2; 
} S1_TYPE; 
 
/* in generated header file */ 
typedef struct _S1_TYPE { 
    long l1; 
    union { 
        float f1; 
        double d2; 
    } U1_TYPE; 
} S1_TYPE; 
 

Remarks

The switch keyword selects the discriminant for an encapsulated_union.

See Also

IDL, non-encapsulated_union, switch_is, switch_type, union