Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pointers 过程指针,派生类型_Pointers_Fortran_Function Pointers - Fatal编程技术网

Pointers 过程指针,派生类型

Pointers 过程指针,派生类型,pointers,fortran,function-pointers,Pointers,Fortran,Function Pointers,以下内容未在英特尔Fortran XE 2011中编译: TYPE type1 procedure(interface1),POINTER::p END TYPE type1 ABSTRACT INTERFACE integer function interface1(a) real,intent(in)::a END function interface1 END INTERFACE 错误: error #8262: The passed-

以下内容未在英特尔Fortran XE 2011中编译:

TYPE type1
    procedure(interface1),POINTER::p
END TYPE type1

ABSTRACT INTERFACE 
    integer function interface1(a)
        real,intent(in)::a    
    END function interface1
END INTERFACE
错误:

error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined.

nopass
属性添加到过程指针组件的声明中

procedure(interface1), pointer, nopass :: p
编辑:对于您的评论,如果您想使用pass关键字,则必须更改界面:

ABSTRACT INTERFACE integer function interface1(passed_object, a) import :: type1 class(type1), intent(...) :: passed_object real, intent(in) :: a END function interface1 END INTERFACE 抽象接口 整数函数接口1(传递的对象,a) 导入::类型1 类(type1),意图(…)::传递的\u对象 真实的,真实的意图 终端功能接口1 端接口
谢谢请您解释一下,为什么这样可以解决我的问题?如果不显式指定
nopass
属性,组件将自动具有
pass
属性(也可以显式指定)。这意味着过程的第一个伪参数的类型应与所定义的类型相同(如错误消息中所述)。当引用procpointer组件时,调用它的对象会自动作为第一个参数传递。如果我想使用
pass
关键字,我需要如何更改
interface 1
?@user578832:我已经更新了回答您的问题的答案。