(j3.2006) a question on c_f_pointer call
Aleksandar Donev
donev
Fri Aug 27 12:16:31 EDT 2010
On 08/27/10 11:57, Bill Long wrote:
> For many implementations (excluding NAG, evidently) the needed
> information is included in the descriptor. Until we introduced
> C_F_POINTER and C_LOC, that worked fine.
Which descriptor?!? There is the pointer/allocatable array descriptor
that was originally filled in by ALLOCATE. Sure, setting a field there
is easy. But then, this field has to be *consistently* copied at every
pointer assignment and at every procedure call. If you pass the array
created by allocate to a TARGET dummy, someone can point a pointer to
the dummy. You can pass sections, and someone can pointer a pointer to
that section. They can do pointer rank remapping, and go through several
pointers of different rank, and then back. As long as in the end one
gets a pointer that points to all of the elements of the original target
created by allocate, your flag in the descriptor has to be set to
"eligible for deallocation". How you can do this without any
calculations at pointer assignments or procedure calls is beyond me.
Just copying the flag does not work---you have to look at whether the
pointer is "associated with the whole of an object that was created by
allocation...in array element order". This has some overhead.
If you asked me, I would not have required error reporting, so that
different implementations are all valid and you can argue internally in
your team about which overhead is bigger or more frequent than other
overheads. But to claim that c_f_pointer changed this in some
fundamental way still seems wrong to me.
Best,
Aleks
--
Aleksandar Donev, Assistant Professor of Mathematics
Courant Institute of Mathematical Sciences
Office: 909 Warren Weaver Hall, New York University
E-mail: donev at courant.nyu.edu
Phone: (212) 992-7315; Fax: (212) 995-4121
Mailing address: 251 Mercer St, New York, NY 10012
Web: http://cims.nyu.edu/~donev
More information about the J3
mailing list