(j3.2006) What Happened to Reallocate?

Bill Long longb
Fri Sep 21 17:00:32 EDT 2012


What usage is needed beyond what you can already do with either the 
MOVE_ALLOC intrinsic, or the feature of reallocating on assignment?

Cheers,
Bill


On 9/21/12 3:51 PM, Craig Dedo wrote:
> 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=&gid=145550&item=166730648&type=member&commentID=96072502&trk=hb_ntf_COMMENTED_ON_GROUP_DISCUSSION_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:  <craig at ctdedo.com
> <mailto:craig at ctdedo.com>>
>
> USA
>
> Linked-In: http://www.linkedin.com/in/craigdedo
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list