以下适用于 gfortran 或 f95,但不适用于 ifort:
interface add
procedure addr, addi
end interface add
real a, b
integer i, j
data a, b, i, j /1.0, 2.0, 1, 2/
call add(a,b)
call add(i,j)
stop
contains
subroutine addr(x,y)
real x, y
print *, x+y
return
end subroutine addr
subroutine addi(m, n)
integer m, n
print *, m+n
return
end subroutine addi
end
ifort 返回此错误:
error #6643: This statement is incorrectly positioned.
procedure addr, addi
---------^
error #8168: Parentheses are required after the PROCEDURE keyword.
procedure addr, addi
---------^
假设不能使用任何模块过程(我们不希望模块中有 addr 和 addi)并且 ifort 必须用作编译器。任何帮助,将不胜感激。