小编Oma*_*ile的帖子

带有过程参数的通用类型绑定过程

我正在尝试编写一个通用的类型绑定过程,它将不同的回调函数作为参数。当编译以下代码(使用 ifort 12.1.3)时,我收到以下警告:

module test

type :: a_type
  contains
  procedure :: t_s => at_s
  procedure :: t_d => at_d
  generic :: t => t_s,t_d
end type a_type

abstract interface
  integer function cb_s(arg)
  real(4) :: arg
  end function cb_s

  integer function cb_d(arg)
  real(8) :: arg
  end function cb_d
end interface

contains

subroutine at_s(this,cb)
  class(a_type) :: this
  procedure(cb_s) :: cb 
end subroutine

subroutine at_d(this,cb)
  class(a_type) :: this
  procedure(cb_d) :: cb 
end subroutine

end module test
Run Code Online (Sandbox Code Playgroud)

警告:

compileme.f(27): warning #8449: The type/rank/keyword signature …
Run Code Online (Sandbox Code Playgroud)

fortran fortran2003

5
推荐指数
1
解决办法
2717
查看次数

标签 统计

fortran ×1

fortran2003 ×1