HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
PARAMETER (statement and attribute)
Chapter 10420
PARAMETER (statement and attribute)
Defines a named constant.
Syntax
A type declaration statement with the PARAMETER attribute is:
type
,
attrib-list
::
cname1
=
cexpr1
[,
cname2
=
cexpr2
]...
type
is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE
(
name
), etc.).
attrib-list
is a comma-separated list of attributes including PARAMETER and optionally
those attributes compatible with it, namely:
Specifying the SAVE attribute in a PARAMETER statement has no effect.
cname
is the name that will represent the constant.
cexpr
is an initialization expression that evaluates to the constant represented by
cname
. In the case of an array constant,
cexpr
must be an array constructor.
In the case of a derived type constant,
cexpr
must be a structure
constructor.
The syntax of the PARAMETER statement is:
PARAMETER (
cname1
=
cexpr1
[,
cname2
=
cexpr2
]...)
Description
The PARAMETER statement associates a symbolic name with a constant. A symbolic name
defined in a PARAMETER statement is known as a named constant. A named constant must
not become defined more than once in a program unit. Once defined, it can be used only as a
named constant. This means that a named constant cannot be assigned a value like a
variable.
When the PARAMETER attribute is used, the value of the named constant must be provided by
the initialization part of the statement in which the PARAMETER attribute appears.
Table 10-42
DIMENSION PUBLIC
PRIVATE SAVE