I believe this demonstrates an error in DVF! Not the only one in my
experience!
On Tue, 09 Dec 1997 09:21:24 +0100 Magne Rudshaug <[log in to unmask]> wrote:
> Hi again!
>
> Thanks for the replys to my previous mail. One advice was to introduce the
> PRIVATE statement inside the B module. This seems to be a quite sensible
> thing to do. But the following example, compiled with Visual Fortran 5.0,
> seems to show that this doesn't work.
>
> -------------------------------------------------------------------------------
> module amod
> implicit none
> private
> integer, public :: a
> public :: inita
> contains
> subroutine inita
> a = 1234
> end subroutine inita
> end module amod
>
> module bmod
> use amod
> implicit none
> private
> integer, public :: b
> public :: initb
> contains
> subroutine initb
> call inita
> b = a+5678
> end subroutine initb
> end module bmod
>
> program testmod
> use bmod
> implicit none
>
> call initb
>
> write (*,*) 'a=', a
> write (*,*) 'b=', b
>
> end program testmod
>
> -------------------------------------------------------------------------------
>
> output from the program:
>
> a= 1234
> b= 6912
>
> -------------------------------------------------------------------------------
>
> The behaviour I would expect was that the variable a would not be recognized
> and that a compilation error would result. My understanding from the F90
> documentation I have read so far is that the PRIVATE statement in the bmod
> module concerns all enteties accessible in the bmod module, and this
> includes the variable a and the subroutine inita from the amod module. Is my
> understanding of this wrong?
>
> Thanks in advance for any reply!
>
>
> Magne Rudshaug
>
--
Lawrie Schonfelder
Director, Computing Services Dept.
The University of Liverpool, UK, L69 7ZF
Phone: 44(151)794 3716, Fax: 44(151)794 3759
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|