(j3.2006) Multiple interfaces for same procedure
Bill Long
longb
Tue Mar 8 20:53:11 UTC 2011
Is it allowed to have two interfaces for the same procedure accessible
(excluding the submodule case)? For example:
module modu
interface
subroutine sub(x)
real x
end subroutine sub
end interface
end module modu
subroutine sub(x)
use modu
real x
x = 2.3
end subroutine sub
This gives no error with 3 compilers, but one compiler complains about
the multiple definition of "sub".
Somewhat more concerning is this example:
module modu
interface
recursive subroutine sub(x)
integer x
end subroutine sub
end interface
end module modu
recursive subroutine sub(x)
use modu
real x
x = 2.3
end subroutine sub
In this case, the two accessible interfaces for SUB are actually
*different*. Even so, the same 3 compilers gave no error, and the
fourth one issued the same error as for the first example.
Is either of these examples legal?
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list