(j3.2006) a question on c_f_pointer call
Aleksandar Donev
donev
Wed Aug 25 15:51:12 EDT 2010
On 08/25/10 15:34, Jim Xia wrote:
> From implementation point of view, how can one tell if FPTR is
> eligible for deallocation? The CPTR is simply a C pointer, no
> necessary information as to whether they can be deallocated.
You have to look to your allocator, it seems to me. How do you do it now
for this code:
-----------------
real, dimension(:), pointer :: p1, p2
allocate(p2(2:11))
call point_to(p1,p2,10)
deallocate(p1,stat=...)
where
subroutine point_to(p,t,n)
integer :: n
real, pointer :: p(:)
real, target :: t(:)
p=>t(1:n)
end subroutine
-----------------
It seems to me this is legal and does not use C pointers. How do you
establish whether p1 can be deallocated? I am trying to understand why
exactly c_f_pointer is special from using some library that does pointer
assignments like above.
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://j3-fortran.org/pipermail/j3/attachments/20100825/53fa14ab/attachment.htm>
More information about the J3
mailing list