HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
OPTIONAL (statement and attribute)
Chapter 10416
OPTIONAL (statement and attribute)
Identifies optional arguments for procedures.
Syntax
The syntax of the type declaration statement with the OPTIONAL attribute is:
type
,
attrib-list
::
dummy-argument-name-list
type
is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE (
name
), etc.).
attrib-list
is a comma-separated list of attributes including OPTIONAL and optionally
those attributes compatible with it, namely:
dummy-argument-name-list
is a comma-separated list of
dummy-argument-names
.
The syntax of the OPTIONAL statement is:
OPTIONAL [::]
dummy-argument-name-list
Description
If a dummy argument has the OPTIONAL attribute, the corresponding actual argument need
not appear in a procedure reference. In cases where there are arguments that generally do not
change from one reference to another, it is convenient to specify that the arguments are
optional and provide default values for them. They can then be omitted from references in
these general cases. The presence of an optional argument in a procedure may be determined
by using the PRESENT intrinsic function.
Many uses of the ENTRY statement in FORTRAN 77 programs can be replaced by the use of
optional arguments.
The following restrictions apply to the use of the OPTIONAL attribute:
Table 10-41
DIMENSION INTENT TARGET
EXTERNAL POINTER VOLATILE