我偶然发现了一种在子模块中运行父亲程序的方法。我的意思是,这个技巧允许我以与模块的依赖关系树相关的上游方式运行进程。具体来说,这里是一个例子:
module parent
  procedure(likefoo),pointer :: to_foo
  interface 
    subroutine likefoo
    end subroutine likefoo
  end interface
contains
  subroutine run
   call to_foo
  end subroutine
end module 
module child
  use parent
contains
  subroutine foo
      print *, 'hola'
  end subroutine foo
end module 
program main
  use parent
  use child
  to_foo => foo
  call run
end program 
此示例使用 ifort 13.0.0 进行了正面测试。我想知道,此代码是标准允许的,还是因为编译器依赖功能而运行正常?谢谢你的帮助。