如果参数列表不同,Fortran 95 是否允许两个子例程具有相同的名称?

ast*_*y13 2 fortran fortran90 fortran95

如果参数列表的长度不同,Fortran 95 标准是否允许两个子例程(或函数)具有相同的名称?例如,

subroutine a(i)
! code here
end subroutine a

subroutine a(j,k)
! code here
end subroutine a
Run Code Online (Sandbox Code Playgroud)

Ale*_*ogt 5

不是按照问题中给出的字面意思,而是通过使用interface

module a_wrapper

  interface a
    module procedure a_1
    module procedure a_2
  end interface

contains
  subroutine a_1(i)
  ! code here
  end subroutine a

  subroutine a_2(j,k)
  ! code here
  end subroutine a
end module

program test
  use a_wrapper, only: a

  call a(.....)
end program
Run Code Online (Sandbox Code Playgroud)

另请参阅我对这篇文章的回答:在 FORTRAN 子例程中传递不同的变量集或 MSB 在这篇文章中的回答:如何为“分配”编写包装器