Re: Allocatable Arrays As Outputs
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 15:30:01 -0800
Richard Maine wrote:
(snip)
The only thing solved by using pointer is to make the code
f90/f95-conforming, as allocatable dummy arguments require either f2003
or f95+TR. But most compilers do support the TR by now, and that does
not appear to be the OP's problem.
For some that might be enough reason.
I would say that changing to using a pointer here would not solve any
problems, but might add new ones (memory management problems and the
likelihood of errors both go way up with pointers compared to
allocatables).
(someone else wrote)
You also have to use the
save attribute in the subroutine to ensure the memory isn't lost when
the subroutine exits.
That is not so.
In fact, you are not allowed to use SAVE for dummy arguments at all.
The only reason I could think of for that statement was that
one might use a pointer dummy pointing to an ALLOCATABLE.
If one didn't understand that ALLOCATE could be used with pointer
variables, one might try that. It would seem even more error
prone than using pointers alone.
-- glen
.
- References:
- Allocatable Arrays As Outputs
- From: Infinity77
- Re: Allocatable Arrays As Outputs
- From: bonzaboy
- Re: Allocatable Arrays As Outputs
- From: Richard Maine
- Allocatable Arrays As Outputs
- Prev by Date: Re: How to quote the " character in a format statement?
- Next by Date: Re: IVF + Xp (32bit) = 3Gb
- Previous by thread: Re: Allocatable Arrays As Outputs
- Next by thread: The concept of a record
- Index(es):
Relevant Pages
|