HP Fortran Programmer's Reference (September 2007)
HP Fortran statements
EQUIVALENCE
Chapter 10 353
EQUIVALENCE
Associates different objects with same storage area.
Syntax
EQUIVALENCE (
equivalence-list1
) [, (
equivalence-list2
)]...
equivalence-list
is a comma-separated list of two or more object names to be storage
associated. Objects can include simple variables, array elements, array
names, and character substrings.
Description
All objects in each
equivalence-list
share the same storage area. Such objects become
storage associated and are equivalenced to each other. Equivalencing may also cause other
objects to become storage associated.
The following items must not appear in
equivalence-list
:
• Automatic objects, including character variables whose length is specified with a
nonconstant
• Allocatable arrays
• Function names, result names, or entry names
• Dummy arguments
• Records or record field references
• Nonsequenced derived-type objects
• Derived-type components
• Pointers or derived-type objects containing pointers
• Named constants
Derived-type objects may appear in an EQUIVALENCE statement if they have been defined with
the SEQUENCE attribute.
The following restrictions apply to objects that can appear in an EQUIVALENCE statement:
• Objects in the same
equivalence-list
must be explicitly or implicitly declared in the
same scoping unit.
• The name of an equivalenced object must not be made available by use association.