If you know what the target would be, you can say
associated(ptr,target=tgt)
where you know what tgt would have to be and pass it in as well. I've never
used this, but I would surmise that if the pointer was allocated instead of
associated, the above function would return .false.
If you don't know a priori what the tgt would be, I'm not sure. allocated()
doesn't work for pointers, I think. Maybe you could kludge something up with
size()... probably not, though.
If you give more details, maybe we can come up with some other solution.
Alvaro Fernandez
|
|Hello,
|
|Assume a pointer was given to me (as a procedure argument, for
|example), and
|I am not sure if it was associated to a target (via =>) or allocated with
|ALLOCATE. In the first case, I want to NULLIFY it, in the second I want to
|DEALLOCATE it.
|
|Is there a way to do this? The ALLOCATED intrinsic seems to require an
|actual allocatable array, so I can not pass a pointer to it, right?
|
|These ALLOCATED and ASSOCIATED are quite confusing...I know something was
|fixed in F95...
|
|Thanks,
|Aleksandar
|_____________________________________________
|Aleksandar Donev
|http://www.pa.msu.edu/~donev/
[log in to unmask]
|(517) 432-6770
|Department of Physics and Astronomy
|Michigan State University
|East Lansing, MI 48824-1116
|_____________________________________________
|