VMS Help
FORTRAN, Statements, POINTER

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  The POINTER statement establishes pairs of variables and pointers,
  in which each pointer contains the address of its paired variable.
  Statement format:

     POINTER ((pointer,pointee) [,(pointer,pointee)]...

     pointer  Is a variable whose value is used as the
              address of the pointee.

     pointee  Is a variable, array, array declarator, record,
              record array, or record array declarator.

  The following are rules and behavior for the "pointer" argument:

   o  Two pointers can have the same value, so pointer aliasing is
      allowed.

   o  When used directly, a pointer is treated like an integer
      variable.  On VAX systems, a pointer occupies one numeric
      storage unit, so it is a 32-bit quantity (INTEGER*4).

   o  A pointer cannot be pointed to by another pointer; therefore, a
      pointer cannot also be a pointee.

   o  A pointer cannot appear in the following statements:

         ASSIGN       INTRINSIC
         EXTERNAL     PARAMETER

      A pointer can appear in a DATA statement with integer literals
      only.

   o  Integers can be converted to pointers, so you can point to
      absolute memory locations.

   o  A pointer variable cannot be declared to have any other data
      type.

   o  A pointer cannot be a function return value.

   o  You can give values to pointers by using the %LOC built-in
      function to retrieve addresses.  For example:

         integer i(10)
         integer i1 (10) /10*10/
         pointer (p,i)
         p = %loc (i1)
         i(2) = i(2) + 1

   o  The value in a pointer is used as the pointee's base address.

  The following are rules and behavior for the "pointee" argument:

   o  A pointee is not allocated any storage.  References to a
      pointee look to the current contents of its associated pointer
      to find the pointee's base address.

   o  A pointee array can have fixed, adjustable, or assumed
      dimensions.

   o  A pointee cannot appear in the following statements:

         AUTOMATIC       PARAMETER
         COMMON          SAVE
         DATA            STATIC
         EQUIVALENCE     VOLATILE
         NAMELIST

   o  A pointee cannot be a dummy argument.

   o  A pointee cannot be a function return value.

   o  A pointee cannot be a record field or an array element.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.