(j3.2006) What Happened to Reallocate?
Craig Dedo
craig
Fri Sep 21 16:51:12 EDT 2012
Everyone:
I would like the PL22.3 mailing list members to please help me refresh my
memory on why we did not add a Reallocate statement in Fortran 2003. I know that it was
proposed and discussed, but my memory is hazy on the details of why it did not make the
cut of features for Fortran 2003.
This subject came up today on the LinkedIn Fortran programmers Group. Here is
the web link: http://www.linkedin.com/groupItem?view=
<http://www.linkedin.com/groupItem?view=&gid=145550&item=166730648&type=member&commentID=9
6072502&trk=hb_ntf_COMMENTED_ON_GROUP_DISCUSSION_YOU_COMMENTED_ON#commentID_96072502>
&gid=145550&item=166730648&type=member&commentID=96072502&trk=hb_ntf_COMMENTED_ON_GROUP_DI
SCUSSION_YOU_COMMENTED_ON#commentID_96072502
The question was posted by Mathias Perchanok under the title, "Why is there no
Intrinsic Re-Allocation Function?" Here is the body of the question.
[Begin quote from LinkedIn]
A nice feature of the ALLOCATE function is that its argument can be an array of any type
or numbver of subscripts. This is also true for the DEALLOCATE and ALLOCATED functions.
If I want to re-allocate many arrays, then I need to write a function to do that because
re-allocation takes several steps including allocating a buffer array, copying the
contents of the array to be allocated to the buffer, Deallocating and then allocating the
array, copying the buffer to it, and deallocating the buffer, etc. The problem is that if
I have arrays of many types and numbers of subscripts, I need to create a separate
reallocation function for each one, since the dummy argument for the array to be
reallocated must match the actual argument.
Some possible solutions to this are an intrinsic REALLOCATE function, some kind of
equivalent to a C void pointer, or something like a C++ template. Unfortunately, none of
these exist.
I did some experimentation with using INCLUDE files and the renaming feature of USE,
and/or FPP to create a sort of template, and did get that to work, but it is complicated
and hard to explain, and and I got it to work for derived types only. There were also some
problems with the debugger not knowing where to step.
Any ideas?
[End of quote from LinkedIn]
Can anyone help me with this?
Sincerely,
Craig T. Dedo
17130 W. Burleigh Place
P. O. Box 423 Mobile Phone: (414) 412-5869
Brookfield, WI 53008-0423 E-mail: < <mailto:craig at ctdedo.com> craig at ctdedo.com>
USA
Linked-In: <http://www.linkedin.com/in/craigdedo> http://www.linkedin.com/in/craigdedo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20120921/0253500c/attachment-0001.html
More information about the J3
mailing list