HP Fortran Programmer's Reference (September 2007)
HP Fortran statements
ALLOCATE
Chapter 10276
ALLOCATE
Provides storage space for allocatable arrays and pointer targets.
Syntax
ALLOCATE (
allocation-list
[, STAT=
scalar-integer-variable
])
allocation-list
is a comma-separated list of
allocation
.
allocation
is
allocate-object
[(
allocate-shape-spec-list
)].
allocate-object
is
variable-name
or
derived-type-component
. Each
allocate-object
must be an allocatable array or a pointer.
allocate-shape-spec-list
is a comma-separated list of allocate-shape-spec.
allocate-shape-spec
is [
lower-bound
:]
upper-bound
. The bounds in an
allocate-shape-spec
must be scalar integer expressions.
STAT=
scalar-integer-variable
returns the error status after the statement executes. If given, it is set to
zero if the statement successfully executed, and to one of the following
nonzero values if an error occurred:
1 Error occurred after the array was allocated; for example,
an attempt to allocate a previously allocated array.
2 Dynamic memory allocation failure (memory not
available) or invalid size (array too large).
3 Errors of both types 1 and 2 have occurred. This kind of an
error can only occur if the same ALLOCATE statement is
used to allocate more than one array, and both kinds of
errors occur.
If there is no
scalar-integer-variable
, the occurrence of an error causes
the program to terminate.