[J3] An inquiry about the extension with pointer function reference introduced in Fortran 2008

Vipul Parekh parekhvs at gmail.com
Mon Mar 8 00:20:35 UTC 2021


The Introduction section in the 10-007r1 document toward Fortran 2008
states, "A pointer function reference can denote a variable in any variable
definition context."

Does the following then conform?

--- begin program ---
module m
   integer, target :: x(3) = [ 1, 2, 3 ]
contains
   function get() result(p)
      integer, pointer :: p(:)
      p => x
   end function get
   subroutine increment(n)
      integer, intent(inout) :: n(:)
      n = n + 1
   end subroutine increment
end module m
   use m
   call increment( get() )
end
--- end program ---

Thank you,
Vipul Parekh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210307/dd650857/attachment.htm>


More information about the J3 mailing list