(j3.2006) deallocating pointer function results

Cohen Malcolm malcolm
Thu Nov 12 02:40:03 EST 2015


(IMNSHO) pointer assignment is to pointers as assignment is to nonpointers. 
They are precisely analogous.

>Pointers with the INTENT(IN) attribute have that restriction, but that is
>not the case here

Basically, INTENT(IN) is designed to give you compile-time enforcement of 
the restrictions that apply to expression actual arguments.  These really 
are supposed to be essentially the same.

>the standard is too restrictive

Sounds like you are suggesting a wart to me.  DEALLOCATE doing a 
pointer-assignment of NULL() to the pointer variable is an essential part of 
memory management hygiene; in the uncommon case where one wants to invoke a 
function and throw away the result (with deallocation), it is in my opinion 
not too much to ask of the user that they capture the result in a pointer 
variable and DEALLOCATE that pointer variable.

........................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list