Re: explicit array allocation 0

<mlohry@xxxxxxxxx> wrote:

On Jun 10, 1:16 pm, michaelmetc...@xxxxxxxxxxxxxx wrote:

Do you mean that you're trying to avoid the second statement in the

a = 0d0

Mike, correct. Is that too lazy of a question? =)
Having 20 allocations followed by 20 assignments looks ugly, heh.

Well, there is the SOURCE= option in the ALLOCATE statement in f2003.
I'm not sure how many compilers implement that feature yet. I don't
think of this as the kind of reason that feature was added, but it looks
like it ought to work.

I personally think that specifying source=0.0 is less intuitively
obvious than the separate statement, but that's just my own taste. (The
source= option is needed for other cases that could not be done with a
separate assignment statement, notably polymorphic allocation to the
same dynamic type and type parameters as source).

It also would make your code dependent on having a compiler with that
particular f2003 feature.

Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain