构造实体 (Fortran 2003)

请参阅以下 构造实体:Fortran 2008 开始Fortran 2008 结束

如果在 ASSOCIATESELECT TYPE 构造的作用域限定单元中可访问的全局或局部实体的名称与关联名称相同,那么该名称将在 ASSOCIATESELECT TYPE 构造的块中解释为关联名称。 在作用域限定单元中的其他位置,该名称解释为全局实体和本地实体。

示例

Fortran 2008 开始
示例 1: 在以下示例中, ASYNCHRONOUS 语句未定义新变量 a。 它仅为外部作用域中定义的变量 a提供 BLOCK 构造作用域期间的 ASYNCHRONOUS 属性。
PROGRAM foo
  INTEGER :: a

  BLOCK
    ! This a is the same as the a declared outside the BLOCK construct.
    ! It merely gives variable a, defined in the outer scope, the ASYNCHRONOUS  
    ! attribute for the duration of the BLOCK construct scope.  
    ASYNCHRONOUS :: a   
  END BLOCK
END PROGRAM foo
示例 2: 在以下示例中,变量 aBLOCK 构造的构造实体,因为没有在 BLOCK 构造外部声明 a
PROGRAM foo
  BLOCK
    ! This a is a local entity since there is no a in the outer scope.
    INTEGER, ASYNCHRONOUS :: a 
  END BLOCK
END PROGRAM foo
Fortran 2008 结束