02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

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

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

Data types and data objects<br />

Pointers<br />

50<br />

“Pointer assignment” on page 97 for information about associating a pointer with a target<br />

by means of pointer assignment.<br />

Chapter 10, “<strong>HP</strong> <strong>Fortran</strong> Statements” for a full description of the ALLOCATE and<br />

DEALLOCATE statements as well as the POINTER and TARGET attributes.<br />

The following section discusses pointer status and includes an example program.<br />

Pointer association status<br />

Certain pointer operations can only be performed depending on the status of the pointer. A<br />

pointer’s status is called its association status, and it can take three forms:<br />

Undefined The status of a pointer is undefined on entry to the program unit in which<br />

the pointer is declared or if:<br />

Its target is never allocated.<br />

Its target was deallocated (except through the pointer.<br />

The target goes out of scope, causing it to become undefined.<br />

If the association status is undefined, the pointer must not be referenced or<br />

deallocated. It may be nullified, assigned a target, or allocated storage with<br />

the ALLOCATE statement.<br />

Associated The status of a pointer is associated if it has been allocated storage with the<br />

ALLOCATE statement or is assigned a target. If the target is allocatable, it<br />

must be currently allocated.<br />

If the association status is associated, the pointer may be referenced,<br />

deallocated, nullified, or pointer assigned.<br />

Disassociated The status of a pointer is disassociated if the pointer has been nullified with<br />

the NULLIFY statement or deallocated, either by means of the DEALLOCATE<br />

statement or by being assigned to a disassociated pointer.<br />

If the association status is disassociated, the same restrictions apply as for a<br />

status of undefined. That is, the pointer must not be referenced or<br />

deallocated, but it may be nullified, assigned a target, or allocated storage<br />

with the ALLOCATE statement.<br />

You can use the ASSOCIATED intrinsic function to determine the association status of a<br />

pointer; see Chapter 11, “Intrinsic procedures,” on page 467 for a description of this intrinsic.<br />

Chapter 3

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

Saved successfully!

Ooh no, something went wrong!