HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
ALLOCATABLE (statement and attribute)
Chapter 10 275
If (
deferred-shape-spec-list
) is omitted from the ALLOCATABLE statement, it must be
specified in another declaration statement, such as a type or DIMENSION statement.
The ALLOCATED intrinsic inquiry function is described in “ALLOCATED(ARRAY)” on
page 521. It can be used to determine whether an allocatable array is currently allocated.
Description
The ALLOCATABLE attribute or statement is used to declare an array whose extents in all its
dimensions will be specified when an ALLOCATE statement is executed at run-time; for this
reason it is known as “deferred-shape”. When an allocatable array is declared, only its name
and rank are given.
Examples
The following statements declare a rank-one deferred-shape array and illustrate its use with
different extents.
! mls is deferred shape.
INTEGER, ALLOCATABLE :: mls(:)
ALLOCATE (mls (3)) ! Allocate 3 elements.
DEALLOCATE (mls) ! mls is no longer allocated
ALLOCATE (mls (-n:n)) ! Allocate with different extent
Related statements
ALLOCATE and DEALLOCATE
Related concepts
See “Allocatable arrays” on page 64 for more information about allocatable arrays and the
conditions applying to their use.
Array pointers provide a more general mechanism for the manipulation of deferred-shape
arrays; see “Array pointers” on page 63.