"Tobias Burnus" <
bur...@net-b.de> wrote in message
news:4F3E1BD5...@net-b.de...
> And you need to rename at least one of the specific procedures
> ("subroutine foo"); it is probably less confusing if you rename both - as
> Aris and I did.
No you don't. This is an important point as far as I'm concerned
because I not infrequently create generic functions as copies of
one master function via INCLUDE. Doing so means all changes may
be preserved in a single file rather than having to keep track
of all different copies of what is really the same function and
modifying each separately. This requires that each procedure
have the same name. Here is my example:
C:\gfortran\clf\overload>type overload.f90
module integer_mod
implicit none
private
public foo_public
interface foo_public
module procedure foo
end interface foo_public
contains
subroutine foo(arg)
integer, intent(in) :: arg
print *, arg
end subroutine foo
end module integer_mod
module complex_mod
implicit none
private
public foo_public
interface foo_public
module procedure foo
end interface foo_public
contains
subroutine foo(arg)
complex, intent(in) :: arg
print *, arg
end subroutine foo
end module complex_mod
module foo_mod
use integer_mod, only: foo => foo_public
use complex_mod, only: foo => foo_public
implicit none
end module foo_mod
program f04
use foo_mod
implicit none
complex, parameter :: x= CMPLX(0,2.0*ACOS(0.0))
integer, parameter :: y=5
CALL foo(x)
CALL foo(y)
end program f04
C:\gfortran\clf\overload>gfortran overload.f90 -ooverload
C:\gfortran\clf\overload>overload
( 0.0000000 , 3.1415927 )
5
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end