(j3.2006) VOLATILE or ASYNCHRONOUS function results ??

Cohen Malcolm malcolm
Mon Jan 9 19:43:28 EST 2017


I don't see any obvious problem here.

<<<
Characteristics of procedure arguments include "whether it has the 
ASYNCHRONOUS (8.5.4), CONTIGUOUS (8.5.7), VALUE (8.5.18), or VOLATILE 
(8.5.19) attributes,"

whereas

Characteristics of function results include (in the corresponding sentence) 
"whether it has the CONTIGUOUS attribute,".

This suggests that ASYNCHRONOUS, VALUE, and VOLATILE were not envisioned for 
function results.
>>>

Not at all.

VALUE being an argument passing mechanism obviously that is a red herring 
(like OPTIONAL and INTENT which you did not mention).

What it suggests is that the function result variable being ASYNCHRONOUS or 
VOLATILE has no bearing on the interface of the function.  Which is 
obviously true on the face of it.  The function delivers a result, so 
anything about the variable that does not affect the result is immaterial.

You missed out TARGET, which also matters for arguments, but not for 
function results.  That's because it has no bearing on the value returned; 
like ASYNCHRONOUS and VOLATILE it is only relevant whilst the function is 
active and its result variable has a proper existence.

<<<
Is there a specific prohibition in the standard disallowing VOLATILE or 
ASYNCHRONOUS for function results?  If not, should there be?
>>>

That would be No and No, then.

These are obviously useful and well-defined.  In particular, consider
   READ *,RESULT
when the type has a defined formatted input routine.  That implicitly gives 
RESULT the ASYNCHRONOUS attribute.  It would be beyond counter-intuitive to 
require the user to make an explicit temporary just to read a value into the 
function result.

Cheers,
-- 
.............Malcolm Cohen, NAG Oxford/Tokyo. 




More information about the J3 mailing list