HP Fortran Programmer's Reference (September 2007)

Data types and data objects
Derived types
Chapter 5 125
comp-name
[(
array-spec
)][*
char-len
]
where
array-spec
is an array specification, as described in “Array
declarations” on page 59; and
char-len
is used when
comp-name
is of type
character to specify its length.
Sequence derived type
As shown in “Defining a derived type” on page 123, the SEQUENCE statement may appear in
the definition of a derived type. When storage for a variable of derived type is allocated, the
presence of the SEQUENCE statement in the definition of the derived type causes the compiler
to arrange all components in a storage sequence that is the same as the order in which they
are defined. Such a derived type is called a sequence derived type.
A sequence derived type may appear in a common block or in an equivalence set. The
Standard makes requirements about the type—numeric or character—of the components in a
sequence type. As an extension, HP Fortran makes no restrictions on the types of the
components other than that the definition of the derived type must include the SEQUENCE
statement.
Structure component
A component of a derived-type object may be referenced and used like any other variable—in
an expression, on the lefthand side of an assignment statement, or as procedure argument. It
may be a scalar, an array, or itself a derived-type object. The component name has the same
scope as the derived-type object in which it is declared.
To reference a structure component, use the form:
parent-name
[%
comp-name
]...%
comp-name
parent-name
is a derived type. This part of a structure component reference is the parent
and is joined to
comp-name
by the component selector operator (%). The
comp-name
component to which the parent is joined on its immediate right
must be a component of
parent-name
. If
parent-name
has the INTENT,
TARGET, or PARAMETER attribute, then the structure component being
referenced—the rightmost
comp-name
—also has that attribute.
comp-name
is the name of a component. If more than one
comp-name
appears in a
structure component reference, the reference is to the rightmost
comp-name
.
If more than one
comp-name
appears in the reference, each one (except the
rightmost) must be a derived-type object, and the
comp-name
to its
immediate right must be one of its declared components.