OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
The following example shows how a unique pointer can be used:
[
uuid(D37A0E80-5D23-11C9-B199-08002B13D56D)
] interface Unique_ptrs
{
typedef [ref] long *r_ptr;
typedef [unique] long *u_ptr;
typedef [ptr] long *f_ptr;
void op1 (
[ref,in,out,string] char *my_rname,
[unique,in,out,string] char *my_uname,
[ptr,in,out,string] char *my_pname
);
}
17.14.7.2 Pointer Attributes in Parameters
A pointer attribute can be applied to a parameter only if the parameter contains an
explicit pointer declaration (*).
By default, a single pointer (*) operator in a parameter list of an operation declaration is
treated as a reference pointer. To override this, specify a pointer attribute for the
parameter. When there is more than one pointer operator, or multiple levels of indirection
in the parameter list, the rightmost pointer is the top-level pointer; all pointers to the left
of the rightmost pointer are of a lower level. The top-level pointer is treated as a
reference pointer by default; the lower-level pointers have the semantics specified by the
pointer_default attribute in the interface.
The following example illustrates the use of top- and lower-level pointers:
void op1 ([in] long **p_p_l)
In this example, p_p_l is a pointer to a pointer to a long integer. The first or leftmost
pointer (*) signifies that the pointer to the long integer is a lower-level pointer, and the
second or rightmost pointer (*) signifies that the pointer to the pointer is a top-level
pointer.
Any pointer attribute you specify for the parameter applies to the top-level pointer only.
Note that unless you specify a pointer attribute, the top-level explicit pointer declaration
in a parameter defaults to a reference pointer even if the pointer_default(ptr) interface
attribute is specified.
Using a reference pointer improves performance but is more restrictive. For example, the
pointer declared in the following operation, for the parameter int_value, is a reference
pointer. An application call to this operation can never specify NULL as the value of
int_value.
17 46 Tandem Computers Incorporated 124245