Copyright Digital Equipment Corp. All rights reserved.

Pointer_Types

 A pointer type allows  you  to  refer  to  a  dynamic  variable.
 Dynamic  variables  do  not  have  lifetimes  that  are strictly
 related to the scope of a routine, module, or program;  you  can
 create  and  eliminate  them  at  various  times  during program
 execution.  Also, pointer types clearly define the  type  of  an
 object,  but  you can create or eliminate objects during program
 execution.  A pointer type has the following syntax:

    [[attribute-list]] ^ [[attribute-list]] base-type-identifier

 The 'attribute-list' is one or more  optional  identifiers  that
 provide additional information about the base type.

 The 'base-type-identifier' is the type identifier of the dynamic
 variable to which the pointer type refers.  (If the base type is
 an undiscriminated  schema  type,  you  need  to  supply  actual
 discriminants when you call the NEW function.)

 Unlike  other  variables,  dynamic   variables   do   not   have
 identifiers.  Instead, you access them indirectly with pointers.

 Call  the  NEW  procedure  to  allocate  storage   for   dynamic
 variables.   Call  the  DISPOSE  procedure  to  deallocate  this
 storage.

 Example:  TYPE
           Reservation = RECORD
             Name  : VARYING[30] OF CHAR;
             Class : ( standby, coach, first );
             Flight_number  : INTEGER;
             Next_passenger : ^Reservation;
             END;

           VAR
            Ticket : Reservation;


 In this example, 'Next_passenger' is a  pointer  to  the  record
 type  'Reservation'.   The variable 'Ticket' is declared as type
 'Reservation'.    By   manipulating   the   pointer    variable,
 'Ticket.Next_passenger', a linked list of records can be created
 using these definitions.

 By default,  all  pointer  types  are  32-bits  wide.   The  NEW
 procedure  uses LIB$GET_VM to allocate memory and LIB$FREE_VM to
 dispose of memory.  On OpenVMS Alpha and OpenVMS I64, the [QUAD]
 attribute may be specified before the "^" character resulting in
 a 64-bit pointer.  Using 64-bit  pointers  causes  the  NEW  and
 DISPOSE  procedures  to  LIB$GET_VM_64  to  allocate  memory and
 LIB$FREE_VM_64 to dispose of memory, respectively.


Additional information available:

C_STR_T         POINTER         UNIV_PTR