If someone has a moment to spare could they confirm something for me please? I
am not sure if I am interpreting a point in the standard correctly.
Does section 16.5.7 point (10), regarding a variable with the INTENT(IN)
attribute mentioned in section 5.1.2.7 of the current standard mean that the
following (admittedly almost completely pointless) code is not allowed?
PROGRAM test_sub_call_prog
IMPLICIT NONE
TYPE test_type
INTEGER :: bob=0
END TYPE test_type
TYPE(test_type) :: actual_ttype
actual_ttype%bob=2
CALL asub_sub(actual_ttype,actual_ttype%bob)
PRINT *,'actual_ttype%bob: ',actual_ttype%bob
CONTAINS
SUBROUTINE asub_sub(dummy_ttype,dummy_bob)
IMPLICIT NONE
TYPE(test_type), INTENT(INOUT) :: dummy_ttype
INTEGER, INTENT(IN) :: dummy_bob
dummy_ttype%bob=dummy_bob
END SUBROUTINE asub_sub
END PROGRAM test_sub_call_prog
I'd guessed it probably wasn't, since the fact that both the bob component of
the dummy argument dummy_ttype and the dummy argument dummy_bob are associated
with the actual argument actual_ttype%bob... and that one has INTENT(INOUT) and
the other INTENT(IN) could cause conflicts with the line
"dummy_ttype%bob=dummy_bob"... However it compiled and ran okay and I wanted to
check whether this was a fluke!
Paul
--
==============================================
Paul Suckling
Research Associate
School of Mathematics and Statistics
The University of Birmingham
Edgbaston, Birmingham, B152TT, U.K.
+44(0)121 4146460
http://www.mat.bham.ac.uk/P.M.Suckling/
==============================================
|