インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

Scope

Program entities have the following kinds of scope (as shown in the table below):

Scope of Program Entities

Entity

Scope

Program units

Global

Common blocks1

Global

External procedures

Global

Intrinsic procedures

Global2

Module procedures

Local

Class I

Internal procedures

Local

Class I

Dummy procedures

Local

Class I

Statement functions

Local

Class I

Derived types

Local or construct

Class I

Components of derived types

Local

Class II

Named constants

Local or construct

Class I

Named constructs

Local or construct

Class I

Namelist group names

Local

Class I

OpenMP* reduction identifier

Local

Class I

Generic identifiers

Local or construct

Class I

Argument keywords in procedures

Local

Class III

Variables

Local or construct

Class I

Variables that are dummy arguments in statement functions

Statement

DO variables in an implied-DO list3 of a DATA statement, or an array constructor

Statement

DO index variables of a FORALL statement or construct, or a DO CONCURRENT construct

Construct

Associate names

Construct

Intrinsic operators

Global

Defined operators

Local or construct

Statement labels

Local

External I/O unit numbers

Global

Intrinsic assignment

Global4

Defined assignment

Local or construct

1 Names of common blocks can also be used to identify local entities.

2 If an intrinsic procedure is not used in a scoping unit, its name can be used as a local entity within that scoping unit. For example, if intrinsic function COS is not used in a program unit, COS can be used as a local variable there.

3 The DO variable in an implied-DO list of an I/O list has local scope.

4 The scope of the assignment symbol (=) is global, but it can identify additional operations (see Defining Generic Assignment).

Scoping units can contain other scoping units. For example, the following shows six scoping units:

 MODULE MOD_1                    ! Scoping unit 1
    ...                          ! Scoping unit 1
 CONTAINS                        ! Scoping unit 1
   FUNCTION FIRST                !   Scoping unit 2
     TYPE NAME                   !     Scoping unit 3
     ...                         !     Scoping unit 3
     END TYPE NAME               !     Scoping unit 3
     ...                         !   Scoping unit 2
   CONTAINS                      !   Scoping unit 2
     SUBROUTINE SUB_B            !       Scoping unit 4
       TYPE PROCESS              !         Scoping unit 5
       ...                       !         Scoping unit 5
       END TYPE PROCESS          !         Scoping unit 5
       INTERFACE                 !         Scoping unit 5
         SUBROUTINE SUB_A        !           Scoping unit 6
         ...                     !           Scoping unit 6
           BLOCK                 !             Scoping unit 7
           ...                   !             Scoping unit 7
           END BLOCK             !             Scoping unit 7
         END SUBROUTINE SUB_A    !           Scoping unit 6
       END INTERFACE             !         Scoping unit 5
     END SUBROUTINE SUB_B        !       Scoping unit 4
   END FUNCTION   FIRST          !   Scoping unit 2
 END MODULE                      ! Scoping unit 1

See Also