[J3] Can a procedure pointer have character(*) result type?
Daniel C Chen
cdchen at ca.ibm.com
Wed Nov 30 09:13:02 UTC 2022
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> 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>
Cc: Malcolm Cohen <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,
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
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/e7e85cdd/attachment-0001.htm>
More information about the J3
mailing list