(j3.2006) Did we intend to prohibit this?
Tue Mar 14 02:08:02 EDT 2017
On Tue, 2017-03-14 at 13:49 +0900, Cohen Malcolm wrote:
> As I wrote before, "it" the value does not get "deallocated", it's just a
> value. Not a variable.
> There really is nothing difficult going on here. It is the local variable
> inside the function that is allocatable and thus gets deallocated.
It gets deallocated after the function completes execution, indeed after
the executable construct most closely containing the reference,
completes execution, when the result variable no longer exists. What's
difficult about a "magic" intrinsic function deallocating it instead of
hidden "magic" deallocating it?
> Is it really necessary to be this way? Yes.
> -----Original Message-----
> From: Van Snyder
> Sent: Tuesday, March 14, 2017 12:58 PM
> To: fortran standards email list for J3
> Subject: Re: (j3.2006) Did we intend to prohibit this?
> On Tue, 2017-03-14 at 10:07 +0900, Cohen Malcolm wrote:
> > > then the result variable of F(X) in
> > >
> > > call move_alloc ( f(x), v )
> > >
> > >IS a variable, right? So what's the problem with executing it?
> > That is not standard-conforming because
> > (1) "f(x)" is not even a variable, let alone definable;
> > (2) "f(x)" does not have the ALLOCATABLE attribute.
> Then how is it possible to deallocate it?
> > As explained earlier, MOVE_ALLOC requires both arguments to be
> > definable variables, by virtue of the INTENT specification.
> Is it really necessary for it to be this way? Is there a technical
> problem with
> call move_alloc ( f(x), v )
> instead of
> v = f(x)
> It seems desirable to avoid deallocating v, reallocating it to the same
> shape as f(x), copying the value, and deallocating the result of f(x).
> J3 mailing list
> J3 at mailman.j3-fortran.org
> This e-mail has been scanned for all viruses by Star.
More information about the J3