(j3.2006) Did we intend to prohibit this?
Van Snyder
Van.Snyder
Fri Mar 10 18:17:50 EST 2017
On Fri, 2017-03-10 at 17:12 -0500, Steve Lionel wrote:
> On 3/10/2017 5:00 PM, Van Snyder wrote:
> > According to 9.7.3.2p4, 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
> allocatable.
>
> 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.
I wasn't able to deduce any of this from the standard. The standard
natters on about deallocating an allocatable function result as if it
actually is allocatable.
> Steve
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list