12.07.2015 Views

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The pointer-based variable does not have an address until its corresponding pointer is defined. Thepointer is defined in one of the following ways:• By assigning the value of the LOC function.• By assigning a value defined in terms of another pointer variable.• By dynamically allocating a memory area for the based variable. If a pointer-based variable isdynamically allocated, it may also be freed.ExampleREAL XC(10)COMMON IC, XCPOINTER (P, I)POINTER (Q, X(5))P = LOC(IC)I = 0 ! IC gets 0P = LOC(XC)Q = P + 20! same as LOC(XC(6))X(1) = 0 ! XC(6) gets 0ALLOCATE (X)Restrictions! Q locates a dynamically! allocated memory areaThe following restrictions apply to the POINTER statement:• No storage is allocated when a pointer-based variable is declared.• If a pointer-based variable is referenced, its pointer variable is assumed to be defined.• A pointer-based variable may not appear in the argument list of a SUBROUTINE orFUNCTION and may not appear in COMMON, EQUIVALENCE, DATA, NAMELIST, orSAVE statements.• A pointer-based variable can be adjusted only in a SUBROUTINE or FUNCTIONsubprogram. If a pointer-based variable is an adjustable array, it is assumed that the variablesin the dimension declarator(s) are defined with an integer value at the time theSUBROUTINE or FUNCTION is called. For a variable which appears in a pointer-basedvariable's adjustable declarator, modifying its value during the execution of theSUBROUTINE or FUNCTION does not modify the bounds of the dimensions of the pointerbasedarray.• A pointer-based variable is assumed not to overlap with another pointer-based variable.120 Chapter 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!