OSF DCE Application Development Guide--Core Components

Interface Definition Language
A unique pointer has the following characteristics:
It can have a NULL value.
It can change from NULL to non-NULL during a call. This change results in
memory being allocated on return from the call, whereby the result is stored in the
allocated memory.
It can change from non-NULL to NULL during a call. This change can result in the
orphaning of the memory pointed to on return from the call. Note that, if a unique
pointer changes from one non-NULL value to another non-NULL value, the change
is ignored.
It does not identify particular extents of memory, but only extents of memory that are
suitable for storing the data. If it is important to know that the data is being stored in
a specific memory location, then you should use a full pointer.
If it has a value other than NULL, output data is placed in existing storage.
Unique pointers are similar to reference pointers in the following ways:
No storage pointed to by a unique pointer can be reached from any other name in the
operation. That is, a unique pointer does not allow aliasing of data within the
operation.
Data returned from the called subroutine is written into the existing storage specified
by the unique pointer, if the pointer did not have the value NULL.
With regard to performance, unique pointers have an advantage over full pointers
because unique pointers do not support the referencing of common data by more than
one pointer (aliasing), and they are significantly more flexible than reference pointers
because they can have a value of NULL.
Unique pointers are particularly suitable for creating optional parameters (because you
can specify them as NULL) and for simple tree or singly linked-list data structures. You
specify the three different levels of pointers by attributes, as follows:
[ref] Reference pointers
[unique] Unique pointers
[ptr] Full pointers
124245 Tandem Computers Incorporated 17 45