[J3] Can a procedure pointer have character(*) result type?

Daniel C Chen cdchen at ca.ibm.com
Tue Nov 29 20:32:55 UTC 2022


Thanks Steve,
Yeah, I went through those constraints as well, but not convinced that they are for the dummy procedure pointer case.
I agree with you that the implementation should be similar if not the same.
Daniel

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Steve Lionel via J3
Sent: November 29, 2022 3:29 PM
To: j3 at mailman.j3-fortran.org
Cc: Steve Lionel <steve at stevelionel.com>
Subject: [EXTERNAL] Re: [J3] Can a procedure pointer have character(*) result type?

On 11/29/2022 2: 10 PM, Daniel C Chen via J3 wrote: Is it legal to declare a dummy procedure pointer to have character(*) result type? I couldn’t find anything wording in the standard that disallow it, but want to confirm if this is a legal
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd

On 11/29/2022 2:10 PM, Daniel C Chen via J3 wrote:
Is it legal to declare a dummy procedure pointer to have character(*) result type? I couldn’t find anything wording in the standard that disallow it, but want to confirm if this is a legal program.

Others have noted the lack of a required interface for a call to a procedure with a pointer dummy.

I was wondering if the following constraints were relevant:

C722 A function name shall not be declared with an asterisk type-param-value unless it is of type CHARACTER and is the name of a dummy function or the name of the result of an external function.

C723 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.

C722 probably not, but C723 suggests to me that it being a procedure pointer is a violation. I wasn't certain, though, that the declaration of proc was considered a "function name". I think it is, but am open to other views.

From an implementation viewpoint, I don't see a problem with this usage as it requires no information not present in the declaration of proc.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221129/5c0eecbe/attachment.htm>


More information about the J3 mailing list