> Date: Fri, 22 Mar 2002 17:10:02 -0600
> From: Alvaro Fernandez <[log in to unmask]>
> Note that contained routines like yours don't even get to have their own
> name spaces; if you use an integer "i" in the main routine, you can't
> declare your own "i" in the CONTAINed routine. This is because, basically,
> these routines are meant to work as if you could extract them and substitute
> their statements in place with no change.
This is not correct.
Try running the following --
program q
implicit none
integer :: i
i = 5
call s ()
print *, i
contains
subroutine s()
implicit none
integer :: i
i = 1
print *, i
return
end subroutine s
end program q
Output:
1
5
|