Fortran 内部子程序
示例
不是内部子程序的程序单元可以包含称为内部子程序的其他程序单元。
program prog implicit none contains function f() end function f subroutine g() end subroutine g end program
这样的内部子程序具有许多功能:
子程序中的实体与外部程序之间存在主机关联
隐式键入规则被继承(implicitnone在f上面有效)
内部子程序在主机中具有显式接口
模块子程序和外部子程序可能具有内部子程序,例如
module mod
implicit none
contains
function f()
contains
subroutine s()
end subroutine s
end function f
end module mod