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

Malcolm Cohen malcolm at nag-j.co.jp
Wed Nov 30 05:20:40 UTC 2022


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/73f72f5b/attachment.htm>


More information about the J3 mailing list