(j3.2006) Did we intend to prohibit this?
Fri Mar 10 17:12:27 EST 2017
On 3/10/2017 5:00 PM, Van Snyder wrote:
> According to 220.127.116.11p4, whatever the function result is, it must be
> allocatable, or it couldn't be deallocated.
The difference is that the programmer is not in control of the
allocatable object once the function returns. As Tom says, you can see
the value, but don't have a handle on the allocation. The processor is
responsible for setting up the result variable as allocatable and
deallocating it when the statement completes. You don't get to do
anything to its allocation status or even reference it as if it were an
As Malcolm wrote, the purpose of this feature is to allow a function to
return an arbitrary-shape result, the shape of which is then used in the
context of the function's value. Once the function returns, the fact
that the result is allocatable is invisible to the programmer.
More information about the J3