[J3] [SC22WG5.6604] intent(in) and value

Jeff Hammond jehammond at nvidia.com
Wed Sep 18 07:11:32 UTC 2024


8.5.10 R828 says that INTENT is IN, OUT or INOUT.

8.5.19 C868 says that VALUE cannot be INTENT(OUT) or INTENT(INOUT)

Should I understand that dummy arguments without an INTENT do not have an implicit intent corresponding to any of the explicit INTENT types?  I have always assumed that the default INTENT was INOUT, but that cannot be true since that would conflict with VALUE in the example below.  It seems the default INTENT is “INOUT, unless VALUE, in which case it’s IN-but-also-assignable”.

subroutine foo(a,b)
    implicit none
    integer, value, intent(in) :: a
    integer, value :: b
    ! integer, value, intent(inout) :: c ! not allowed
    ! integer, value, intent(out) :: d ! not allowed
    ! a = 21 ! can't assign because intent(in)
    b = 23 ! can assign
end subroutine foo

Thanks

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240918/d2a2d56c/attachment.htm>


More information about the J3 mailing list