(j3.2006) question about deallocation
Robert Corbett
Robert.Corbett
Mon Mar 30 20:53:03 EDT 2009
Bill Long wrote:
>
>>> The type of the object being deallocated is BASE, and a final routine
>>> is bound to the type, so I would say SUBR1 (only) is executed.
>>
>>
>> Your answer here is what I think a literal reading of the standard
>> would yield. I fear that interpretation will prove troublesome for
>> users.
>
>
> I fear that final subroutines, in general, will prove troublesome for
> users. In this case, Q is not polymorphic and has only one possible
> type. The type EXTENDED is nowhere visible to the finalization process
> for Q. I don't see how SUBR2 would be (or should be) found in this case.
As I mentioned in my first e-mail on this subject, for Sun Fortran it
would be easy. Sun Fortran uses a user-invisible table to track which
objects were allocated by pointer allocations and the sizes of those
objects. The table could be extended to include the addresses of
the finalizers to be run when those objects are deallocated. The table
is indexed by the addresses of the allocated objects. The routine that
implements deallocation does not know and does not need to know the
types of the entities in the DEALLOCATE statements.
Bob Corbett
More information about the J3
mailing list