HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
SAVE (statement and attribute)
Chapter 10456
SAVE (statement and attribute)
Stores variables in static memory.
Syntax
A type declaration statement with the SAVE attribute is:
type
,
attrib-list
::
save-list
type
is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE
(
name
), etc.).
attrib-list
A comma-separated list of attributes including SAVE and optionally those
attributes compatible with it, namely:
save-list
is a comma-separated list of names of objects to save.
The syntax of the SAVE statement is:
SAVE [[::]
save-list
]
Description
The SAVE statement and attribute cause objects in a subroutine or function to be stored in
static memory, instead of being dynamically allocated whenever the procedure is invoked (the
default case). A saved object retains its value and definition, association, and allocation status
between invocations of the program unit in which the saved object is declared.
If
save-list
is omitted, everything in the scoping unit that can be saved is saved. No other
explicit occurrences of the SAVE attribute or the SAVE statement are allowed.
The names of the following may appear in
save-list
:
Scalar variables
Arrays
Named common blocks
Table 10-49
ALLOCATABLE PRIVATE TARGET
DIMENSION PUBLIC VOLATILE
POINTER STATIC