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

John Reid john.reid9 at talktalk.net
Wed Sep 18 08:41:54 UTC 2024


Jeff,

Dummy arguments without an INTENT are just that. It is what we had in 
Fortran 77. They are not required to be definable, as is the case for 
INTENT(INOUT) (see 8.5.10, para 4).

Cheers,

John.


Jeff Hammond via J3 wrote:
>
> 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/8bf0b00c/attachment.htm>


More information about the J3 mailing list