Partager via


union

This statement defines a C-style union.

Syntax

typedef [attributes] union [tag] {
   memberlist
} unionname;

attributes

The attributes helpstring, helpcontext, uuid, hidden, and version are accepted before a union. The helpstring, helpcontext, and Constants [Automation] attributes are accepted on a union member. Attributes (including the square brackets) can be omitted. If uuid is omitted, the union is not uniquely specified in the system.

tag

An optional tag.

memberlist

The list of union members defined with C syntax.

unionname

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

Remarks

The union keyword must be preceded with a typedef. The union description must precede other references to the structure in the library. Members of a union can be of any built-in type, or any type defined lexically as a typedef before the union. For a description of how strings and arrays can be entered, see the sections String Definitions and Array Definitions.

Example

[uuid(BFB7334C-822A-1068-8849-00DD011087E8), helpstring("A task"), helpcontext(1019)] 
typedef union {
   COLOR polycolor;
   int   cVertices;
   boolean filled;
   SAFEARRAY (int) subtasks; 
} UNIONSHOP;