Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-78CE0A00-B853-45EB-8820-1FD2EEE5B607
Visible to Intel only — GUID: GUID-78CE0A00-B853-45EB-8820-1FD2EEE5B607
Association
Association allows different program units to access the same value through different names. Entities are associated when each is associated with the same storage location.
Association can occur in the following ways:
The following example shows name, pointer, and storage association between an external program unit and an external procedure.
Example of Name, Pointer, and Storage Association
! Scoping Unit 1: An external program unit REAL A, B(4) REAL, POINTER :: M(:) REAL, TARGET :: N(12) COMMON /COM/... EQUIVALENCE (A, B(1)) ! Storage association between A and B(1) M => N ! Pointer association CALL P (actual-arg,...) ... ! Scoping Unit 2: An external procedure SUBROUTINE P (dummy-arg,...) ! Name and storage association between ! these arguments and the calling ! routine's arguments in scoping unit 1 COMMON /COM/... ! Storage association with common block COM ! in scoping unit 1 REAL Y CALL Q (actual-arg,...) CONTAINS SUBROUTINE Q (dummy-arg,...) ! Name and storage association between ! these arguments and the calling ! routine's arguments in host procedure ! P (subprogram Q has host association ! with procedure P) Y = 2.0*(Y-1.0) ! Name association with Y in host procedure P ...
The following example shows inheritance association:
TYPE POINT ! A base type REAL :: X, Y END TYPE POINT TYPE, EXTENDS(POINT) :: COLOR_POINT ! An extension of TYPE(POINT) ! Components X and Y, and component name POINT, ! are inherited from the parent type POINT INTEGER :: COLOR END TYPE COLOR_POINT