我'中號試圖調試一些代碼,其中用戶定義的對象的成員神祕改變地址,並同時做我意識到用戶定義的對象做以及。這裏' SA創建它查詢從功能對象地址的小例子,然後從它的成員函數:LOC()的用戶定義的類型給出不同的結果取決於上下文
module foo_module
type foo_type
contains
procedure :: foo
end type foo_type
contains
subroutine foo(this)
class(foo_type) :: this
print *, 'Inside foo this is', loc(this)
end subroutine foo
end module foo_module
program trial
use foo_module
type(foo_type) :: object
print *, 'Object address', loc(object)
call object%foo()
end program trial
示例輸出我得到的是:
Object address 4452052800
Inside foo this is 140734643354880
爲什麼我收到了兩個不同的地址同一個對象?難道我做錯了什麼?或者是有什麼與LOC起作用我不知道'?
我'中號下OSX使用ifort。
這是一個錯誤 - Ian是正確的,LOC給出函數內描述符的地址。我會讓開發人員知道。 –