struct
struct [ struct-tag ] {
[ [ field-attribute-list ]
] type-specifier declarator-list;
...
}
struct-tag
Specifies an
optional tag for the structure.
field-attribute-list
Specifies
zero or more field attributes that apply to the structure member. Valid field
attributes include first_is, last_is, length_is, max_is,
size_is; the usage attributes string, ignore, and context_handle;
the pointer attribute ref, unique, or ptr; and the union
attribute switch_type. Separate multiple field attributes with commas.
type-specifier
Specifies a base_type,
struct, union, or enum type or type identifier. An
optional storage specification can precede type-specifier.
declarator-list
Specifies one
or more standard C declarators, such as identifiers, pointer declarators, and
array declarators. (Function declarators and bit-field declarations are not
allowed in structures that are transmitted in remote procedure calls. These
declarators are allowed in structures that are not transmitted.) Separate
multiple declarators with commas.
Example
typedef struct _PITCHER_RECORD_TYPE {
short
flag;
[switch_is(flag)] union PITCHER_STATISTICS_TYPE p;
} PITCHER_RECORD_TYPE;
Remarks
The struct
keyword is used in a structure type specifier. The IDL structure type specifier
differs from the standard C type specifier in the following ways:
Each structure member can be
associated with optional field attributes that describe characteristics of that
structure member for the purposes of a remote procedure call.
Bit fields and function
declarators are not allowed in structures that are used in remote procedure
calls. These standard C declarator constructs can be used only if the structure
is not transmitted on the network.
The shape of
structures must be the same across platforms to ensure interconnectivity.
See Also