I would appreciate any comments on entity accessibility through
(indirect) use association as expressed in the pseudo code below.
Page 103 of the M&R book Fortran 90/95 explained states:
"A USE statement of the form
USE module-name
is regarded as a re-declaration of all the module entities inside the
local scoping unit, with exactly the same names and properties. ..."
Referring to the pseudo code it is clear that SUB21 in MOD2 can access
SUB11 in MOD1 since MOD2 USEs MOD1.
My question is: Can SUB31 in MOD3 access the entities I11 and SUB11 in
MOD1 through indirect USE of MOD1 via MOD2?
Thank you
David Vowles.
MODULE MOD1
PRIVATE
PUBLIC :: SUB11
INTEGER, PUBLIC :: I11
CONTAINS
SUBROUTINE SUB11(..)
END SUBROUTINE SUB11
END MODULE MOD1
MODULE MOD2
USE MOD1
PRIVATE
PUBLIC :: SUB21
CONTAINS
SUBROUTINE SUB21(..)
CALL SUB11(...) ! *** Access SUB11 through use association
END SUBROUTINE SUB21
END MODULE MOD2
MODULE MOD3
USE MOD2
PRIVATE
CONTAINS
SUBROUTINE SUB31(..)
I = I11 ! *** Access I11 through use association
???????????
CALL SUB11(...) ! *** Access SUB11 through use association
???????????
CALL SUB21(...) ! *** Access SUB21 through use association
END SUBROUTINE SUB31
END MODULE MOD3
|