[J3] Can a procedure pointer have character(*) result type?
Vipul Parekh
parekhvs at gmail.com
Tue Nov 29 20:17:35 UTC 2022
On Tue, Nov 29, 2022 at 3:01 PM Vipul Parekh <parekhvs at gmail.com> wrote:
> ..
> Based on a quick glance at the standard, I think it still supports
> "Assumed character length functions" though it has marked them as
> obsolescent. See B.3.6 in 22-007 (WG5 N191, Dec. 2021) document. ..
>
Hello Daniel,
Forgot to add a sentence: I too couldn't find in the standard that might
prohibit "Assumed character length functions" as dummy procedures.
Hi Brad,
What happens if you try the following with the NAG compiler? Note the
explicit interface for `sub`:
! File p.f90
character(2) :: cc
character(4), external :: foo
interface
subroutine sub(proc, arg)
character(*) :: arg
!character(*) :: proc !! This is OK
character(*), external :: proc !! Question: is this conforming?
end
end interface
cc = "ab"
call sub(foo, cc)
end
! File sub.f90
subroutine sub(proc, arg)
character(*) :: arg
!character(*) :: proc !! This is OK
character(*), external :: proc !! Question: is this conforming?
print*, proc(arg)
end
! File foo.f90
function foo(arg)
character(*) :: foo, arg
foo = arg // "cd"
end function
I expect the resulting program to output '`abcd'.
Regards,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221129/5bd13a22/attachment.htm>
More information about the J3
mailing list