Re: Allocatable Arrays As Outputs
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 12:12:39 -0800
bonzaboy@xxxxxxxxx wrote:
(snip)
You can try using pointers instead (they are pretty simple to use in
f95). If you declare propertynames as a pointer, I.e. replace
'allocatable' with 'pointer', you can still allocate memory as you
have. Then you simply need to declare the variable in the calling
program to also be a pointer (same shape). You also have to use the
save attribute in the subroutine to ensure the memory isnt lost when
the subroutine exits.
The ALLOCATE statement has two uses. One to allocate an ALLOCATABLE
variable, the other to allocate the TARGET of a POINTER variable.
It is probably best not to mix the use of ALLOCATABLE and POINTER
together.
ALLOCATABLE variables are deallocated as appropriate when the
appropriate routine exits. POINTER targets allocated with
an ALLOCATE statement are not automatically deallocated.
If I understand the post above, there is no need for a SAVE
attribute.
-- glen
.
- References:
- Allocatable Arrays As Outputs
- From: Infinity77
- Re: Allocatable Arrays As Outputs
- From: bonzaboy
- Allocatable Arrays As Outputs
- Prev by Date: OT Launched - pictures from Andoya, Norway - Andenes, Bleik, and the rocket range
- Next by Date: Re: The concept of a record
- Previous by thread: Re: Allocatable Arrays As Outputs
- Next by thread: Re: Allocatable Arrays As Outputs
- Index(es):
Relevant Pages
|
|