----- Original Message -----
From: "Peter Shenkin" <[log in to unmask]>
To: <[log in to unmask]>
Sent: 02 April 2003 19:11
Subject: Re: Compiler differences
> Hi,
>
> On Wed, 2 Apr 2003, 5:39pm +0200, [log in to unmask] wrote:
> > .... However, I can find nothing in the
> > standard that prohibits this construct. ...
>
> I have a question. In F95, an unsaved local variable that is
> allocated (but not explicitly deallocated) automatically gets
> deallocated upon exit of the procedure. I would have thought
> "ans" to have the semantics of a local variable; are we quite
> sure that it does not?
This automatic deallocation applies, in f95, only to unsaved, local,
allocatable arrays. "ans" does not fulfil these criteria ("Fortran 90/95
Explained", Section 6.5.1). Allocated pointers, as here, always require
explicit deallocation (ibid., Section 6.5.3).
In the TR, allocatable function results are allowed and these are
automatically deallocated after the referencing statement has finished
execution (ibid., Section 13.3).
Regards,
Mike
|