[J3] Can a procedure pointer have character(*) result type?
Daniel C Chen
cdchen at ca.ibm.com
Wed Nov 30 15:11:26 UTC 2022
Hi Bill,
It should be C724 in F2018.
It states:
“C724 A function name declared with an asterisk type-param-value shall not be an array, a pointer, elemental, or pure. A function name declared with an asterisk type-param-value shall not have the RECURSIVE attribute.”
I am not sure how it disallows the procedure pointer case.
Thanks,
Daniel
From: Long, Bill F <william.long at hpe.com>
Sent: November 30, 2022 9:43 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Daniel C Chen <cdchen at ca.ibm.com>; Malcolm Cohen <malcolm at nag-j.co.jp>
Subject: [EXTERNAL] Re: [J3] Can a procedure pointer have character(*) result type?
Which version of the standard is this C723 from? Does not look anything like the C723 in either F2018 or N2209. Also, I suspect the omitted .. . text effectively excludes the confusing cases. Cheers, Bill From: J3 <j3-bounces@ mailman. j3-fortran. org>
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Which version of the standard is this C723 from? Does not look anything like the C723 in either F2018 or N2209.
Also, I suspect the omitted ... text effectively excludes the confusing cases.
Cheers,
Bill
________________________________
From: J3 <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>> on behalf of Daniel C Chen via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Sent: Wednesday, November 30, 2022 3:13 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc: Daniel C Chen <cdchen at ca.ibm.com<mailto:cdchen at ca.ibm.com>>; Malcolm Cohen <malcolm at nag-j.co.jp<mailto:malcolm at nag-j.co.jp>>
Subject: Re: [J3] Can a procedure pointer have character(*) result type?
Hi Malcolm,
C723 states “A function name….shall not be…, a pointer”. Is a procedure pointer name also a function name? It seems unclear to me as its procedure target can also be a subroutine.
Thanks,
Daniel
From: J3 <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>> On Behalf Of Malcolm Cohen via J3
Sent: November 30, 2022 12:21 AM
To: 'General J3 interest list' <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc: Malcolm Cohen <malcolm at nag-j.co.jp<mailto:malcolm at nag-j.co.jp>>
Subject: [EXTERNAL] Re: [J3] Can a procedure pointer have character(*) result type?
Daniel writes > The question I have is regarding if a assumed-length dummy procedure pointer is allowed. No, it is not. The constraint > C723 A function name declared with an asterisk type-param-value shall not be an array, a pointer,
Daniel writes
> The question I have is regarding if a assumed-length dummy procedure pointer is allowed.
No, it is not.
The constraint
> C723 A function name declared with an asterisk type-param-value shall not be an array, a pointer,
is operational: there is no doubt that a procedure pointer is a pointer, see the definition of pointer:
3.108
pointer
data pointer or procedure pointer
Therefore assumed-length is not permitted.
> From an implementation viewpoint, I don't see a problem with this usage
I do. That comment assumes information that is not necessary to be passed is nonetheless passed. I see no reason to assume all implementations pass unnecessary information unnecessarily. (Individual implementations may have their own reasons for passing extra information.)
> Your example without pointer worked fine with NAG, but I get an internal compiler error (ICE) when you add it back in
There seems to be a missing error test. I will look into it.
***
Finally, I note that assumed-length functions were already obsolescent in Fortran 95. Procedure pointers were only added in Fortran 2003. It is the long-standing policy of the committee that unless there are good reasons to the contrary, obsolescent features will not be enhanced.
So it is not a surprise that we did not add this feature.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221130/c3d11b98/attachment-0001.htm>
More information about the J3
mailing list