Re: internal procedure can't use array of derived type from main

From: Dr. Richard E. Hawkins (hawk_at_slytherin.ds.psu.edu)
Date: 03/15/04


Date: Mon, 15 Mar 2004 21:21:46 +0000 (UTC)

In article <m1fzcaq6is.fsf@macfortran.local>,
Richard Maine <nospam@see.signature> wrote:
>hawk@slytherin.ds.psu.edu (Dr. Richard E. Hawkins) writes:

>> So my solution is that I'm using an out where I should be using an inout

>I had missed that one. Good catch by Mike. But watch out for another,
>somewhat related, "gotcha". Looks to me like the internal procedure is
>accessing the same variable both via argument association and via
>host association. That is legal... but puts very serious limits on
>what you can do with the variable... making intent(inout) simillarly
>dubious, even if it happens to actually work for your immediate
>application with the current compiler.

Hmm, curioser and curioser.

This is another exercise in psychotic dynamic programming.

My thinking was to access the array of possible states from the
subroutine. I also had the result passed back--but I suppose I can
actually eliminate that return value entirely, which would clean things
up.

All the subroutine really needs to know is the array index, and the last
two array indices called (stopping conditions are the same state being
reached in either of the last two calls, indicating either a potential
steady state or a potential flip cycle).

It also doesn't need to directly pass the result back, as it marks a
%calculated in the array for that entry.

Looks like I outsmarted myself on this one :)

>When you access the same data by argument association and by some
>other method, that generally means that you aren't allowed to change
>the value via either name. (Because temporary copies might be
>involved, and this can cause problems with the copy and the
>original getting different values. Well, in practice that's my
>explanation for why it is illegal - the standard just says that it
>is illegal.)

OK, I won't pass the values at all!

thanks

hawk

>--
>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

-- 
Richard E. Hawkins, Asst. Prof. of Economics    /"\   ASCII ribbon campaign
dochawk@psu.edu  111 Hiller (814) 375-4846      \ /   against HTML mail
These opinions will not be those of              X    and postings. 
Penn State until it pays my retainer.           / \