Thoughts on allocatable components
Erik Edelmann
erik.edelmann@iki.fi
Fri Mar 10 23:50:00 GMT 2006
Here's some thoughts about implementing the allocatable
components stuff. Fell free to add things to the list if I
forgot something (or remove things, if you feel they shouldn't be
there :-).
What needs to be done (roughly in this order):
* Declaration of allocatable components, explicit allocation &
deallocation. NOTE: Deallocation recursive if necessary.
* Automatic deallocation:
* Automatic variables on procedure exit.
* Function results, when the result has been used
* INTENT(OUT) dummies on procedure entry.
* Assignments: Allocate automatically, if not allocated to the
correct size (deallocate first if allocated to the wrong size)
* In a structure constructor for such a type, the expression
corresponding to an allocatable array component can be
* The NULL() intrinsic, indicating an unallocated array.
* An allocatable array which may be allocated or unallocated.
* Any other array expression, indicating an allocated array.
Difficulties:
* The recursive deallocations might be a bit tricky. When that's
working, the automatic deallocation things will be pretty
straight forward.
* The assignment-stuff is going to be hard as well. It depends a
little bit on how optimal we want to make it of course: the
"simple" but sub-optimal solution would be to allways
deallocate (and then allocate again).
* I'm not yet sure how hard the structure constructor part will
be.
Erik
More information about the Fortran
mailing list