XL Fortran for AIX 8.1

Language Reference

+-------------------------------IBM Extension--------------------------------+

POINTER (integer)

Purpose

The integer POINTER statement specifies that the value of the variable int_pointer is to be used as the address for any reference to pointee.

The name of this statement has been changed from POINTER to integer POINTER to distinguish it from the Fortran 90 POINTER statement. The functionality and syntax for this statement remain the same as in previous releases of XL Fortran; only the name has changed.

Format



            .-,-----------------------------.
            V                               |
>>-POINTER----(--int_pointer--,--pointee--)-+------------------><
 
 

int_pointer
is the name of an integer pointer variable

pointee
is a variable name or array declarator

Rules

The compiler does not allocate storage for the pointee. Storage is associated with the pointee at execution time by the assignment of the address of a block of storage to the pointer. The pointee can become associated with either static or dynamic storage. A reference to a pointee requires that the associated pointer be defined.

An integer pointer is a scalar variable of type INTEGER(4) in 32-bit mode and type INTEGER(8) in 64-bit mode that cannot have a type explicitly assigned to it. You can use integer pointers in any expression or statement in which a variable of the same type as the integer pointer can be used. You can assign any data type to a pointee, but you cannot assign a storage class or initial value to a pointee.

An actual array that appears as a pointee in an integer POINTER statement is called a pointee array. You can dimension a pointee array in a type declaration statement, a DIMENSION statement, or in the integer POINTER statement itself.

If you specify the -qddim compiler option, a pointee array that appears in a main program can also have an adjustable array specification. In main programs and subprograms, the dimension size is evaluated when the pointee is referenced (dynamic dimensioning).

If you do not specify the -qddim compiler option, a pointee array that appears in a subprogram can have an adjustable array specification, and the dimension size is evaluated on entrance to the subprogram, not when the pointee is evaluated.

The following constraints apply to the definition and use of pointees and integer pointers:

Examples

     INTEGER A,B
     POINTER (P,I)
     IF (A<>0) THEN
       P=LOC(A)
     ELSE
       P=LOC(B)
     ENDIF
     I=0         ! Assigns 0 to either A or B, depending on A's value
     END

Related Information

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]