Re: Allocating arrays inside a subroutine.
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Tue, 29 Aug 2006 07:52:45 -0700
<deltaquattro@xxxxxxxxx> wrote:
[on allocating an array in a subroutine]
I usually cope with this by taking away DATA_ARRAY
from the arguments of READ_DATA and putting it in a module:...
Since no one else suggested this, I wonder if that's the best way to
get the job done (my compiler doesn't support "extended allocatables",
even though I'm trying to have this fixed).
It's a fine way for some cases. Hard to say what is "best"; I'd probably
just avoid using the superlative in this context.
To the extent that the subroutine always deals with the same array,
putting the array in a module seems to me like a fine approach. It does
have the advantage of working on any f90/f95 compiler out there,
avoiding dependence on the allocatable TR.
The biggest disadvantage would be in cases where the subroutine might be
called from multiple places with different arrays. In a case like that,
you really want the flexibiliy of passing the array as an argument. But
it doesn't sound like that is likely at issue for the code in question.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- References:
- Allocating arrays inside a subroutine.
- From: Timothy Hume
- Re: Allocating arrays inside a subroutine.
- From: deltaquattro
- Allocating arrays inside a subroutine.
- Prev by Date: Re: VB .Net and Intel Visual Fortran 9
- Next by Date: Re: closing unit=5 and unit=6 and print *
- Previous by thread: Re: Allocating arrays inside a subroutine.
- Next by thread: Re: Allocating arrays inside a subroutine.
- Index(es):
Relevant Pages
|