FORTRAN associated

在/src/io/calc_df.F90中,有许多:

DO WHILE(ASSOCIATED(current))

下面整理一些有关associated的用法。


简单的说associated返回一个逻辑值,用于指针的语法。

ASSOCIATED

Inquiry Intrinsic Function (Generic):

Returns the association status of its pointer argument or indicates whether the pointer is associated with the target.

Syntax

result = ASSOCIATED (pointer [, target])

pointer (Input)

Must be a pointer (of any data type).

target (Optional; input)

Must be a pointer or target.

The pointer (in pointer or target) must not have an association status that is undefined. ???

Results:

The result is a scalar of type default logical.

  1. If only pointer appears, the result is true if it is currently associated with a target; otherwise, the result is false.
  2. If target also appears and is a target, if pointer is currently associated with target; otherwise, the result is false.
  3. If target is a pointer, the result is true if both pointer and target are currently associated with the same target; otherwise, the result is false.
  4. If either pointer or target is disassociated, the result is false.

如果上面的英文对你来说还不够的话,下面再贴上一个中文的解释(个人感觉更看不懂)。
fortran中有关指针的用法总结(此文来自科学网何林博客)

你可能感兴趣的:(FORTRAN associated)