At 06:57 PM 6/6/00 -0700, Van Snyder wrote:
>1. What do you think the "right" answers are for P1 and P2?
There is no "right" answer -- the program appears not to be standard
conforming:
When a dummy argument has the TARGET attribute and a pointer is associated
with it, there are two possible cases:
1. If the corresponding actual argument also has the TARGET attribute, the
pointer is also associated with the actual argument and the pointer remains
defined after the execution of the procedure.
2. If the corresponding actual argument does not have the TARGET attribute,
then the pointer is associated only with the dummy argument and the
pointer's association status becomes undefined after the execution of the
procedure.
Since the actual arguments in this case were expressions (i.e., the result
of applying the RESHAPE function), they don't have the TARGET attribute, so
the results of RES1 and RES2 are pointers with an undefined association
status, and the pointer assignments to p1 and p2 are invalid.
If we were to assume that RESHAPE "passes through" the TARGET attribute,
then I agree with the expectation that P1
be 11 21 31 41 12 22 32 42 13 23 33 43 14 24 34 44 and P2 be as Van
suggests. (Absent the optional argument to alter the dimension order,
RESHAPE preserves array element order, as does pointer assignment.)
-Kurt
--
Kurt W. Hirchert [log in to unmask]
Center for Computational Sciences +859-257-8748
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|