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.

eferenced, the address to which it refers is always taken from its associated pointer (thatis, its pointer variable is dereferenced).The pointer-based variable does not have an address until its corresponding pointer is defined.The pointer 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-basedvariable is dynamically allocated, it may also be freed.The following code illustrates the use of pointers:REAL 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)! Q locates an allocated memory area2.9.1 RestrictionsThe 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 declarators are defined with an integer value at the time the SUBROUTINEor FUNCTION is called. For a variable which appears in a pointer-based variable's adjustable50 Chapter 2

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

Saved successfully!

Ooh no, something went wrong!