PreviousNext

The pointer_default Attribute

IDL supports two kinds of pointer semantics. The pointer_default attribute specifies the default semantics for pointers that are declared in the interface definition. The pointer_default attribute takes the form:

pointer_default (pointer_attribute)

Possible values for pointer_attribute are ref, unique, and ptr.

The default semantics established by the pointer_default attribute apply to the following uses of pointers:

· A pointer that occurs in the declaration of a member of a structure or a union.

· A pointer that does not occur at the top level of an operation parameter declared with more than one pointer operator. A top-level pointer is one that is not the target of another pointer and is not a field of a data structure that is the target of a pointer. (See Pointer Attributes in Parameters, which describes pointer attributes in parameters, for more information on top-level pointers.)

Note that the pointer_default attribute does not apply to a pointer that is the return value of an operation because this is always a full pointer.

The default semantics can be overridden by pointer attributes in the declaration of a particular pointer. If an interface definition does not specify pointer_default and contains a declaration that requires default pointer semantics, the IDL compiler will issue an error. For additional information on pointer semantics, refer to Pointer Attributes.

The pointer_default attribute can appear at most once in an interface.