MOVE_ALLOC to grow an array

Oh sorry, somehow I missed the central info on the page.

Perfect! Now I fully understand, thanks a lot for the snippet. Gotta buy the red book, has been on the amazon wishlist for too much already :upside_down_face:

I consider this to me an important missing feature in fortran. It should be possible for the programmer to directly manipulate the metadata associated with allocatable and pointer entities. Part of that would be the ability to reset the bounds of existing arrays. This could be implemented in several ways, e.g. during the assignment, or after the assignment in a separate statement.

If you remember in f90, it was not possible to set the lower bounds during pointer assignment either. There was a workaround (do a subroutine call that changed the target bounds, then do the pointer assignment). That oversight was eventually corrected in f2003.

2 Likes