Hello,
> I don't understand this. There is only one pointer in the example:
> Q. No "pointer to a pointer" is present
I was referring to the implementation and using pointer in the C sense of a memory
address. Think of a pointer as a memory address. Then once the pointer is assigned
to point to a target the value of that address is set to the address of the target.
If the target is an unallocated array, this will be either 0 or some random number
(i.e. undefined). There is no way to change the value of this memory address when
the allocatable array is allocated--the pointer contains no reference to the
allocatable array, but rather the memory occupied by the array. Even if the
standard never says this explicitly, this is what is done in implementations as far
as I know. I am not sure why you expect a pointer to follow an allocatable array
around--this is not their purpose. The allocatable array is already dynamic, and
this would be the same as expecting a pointer to follow a pointer it was once
assigned to. This is what I meant by wrong "flow of execution"--going back in time
to change something that was done earlier in the execution.
Best,
Aleksandar
|