[PATCH, Fortran] Parse FINAL procedure declarations

Daniel Kraft d@domob.eu
Fri May 23 14:12:00 GMT 2008


Tobias Burnus wrote:
> Daniel Kraft wrote:
>> Well, he just agreed it would be a good idea to write non-scalar FINAL 
>> procedures with assumed shape argument.
> 
> An alternative are ELEMENTAL subroutines; in that case you do not need 
> an array version.
> 
>> That we could warn about this was an idea from me (I'll have to look 
>> at the standard more closely what happens if an explicit shape is 
>> given and an array of another shape is to be finalized... As far as I 
>> remember it just stated "find a procedure matching in rank and kind 
>> and call it" so that would imply call it anyways?
> 
> My understanding is for arrays:
> - First search a FINAL procedure with a matching rank; when found one, 
> call it.
> - Otherwise: If there is an ELEMENTAL finalization subroutine, call it.
> - Otherwise: Do not call anything

That's what I understand the standard.  But I was thinking about a 
procedure like:

SUBROUTINE final_vector(v)
   IMPLICIT NONE
   TYPE(mytype) :: v(42)
END SUBROUTINE final_vector

Could this be called for a vector of dimension, say, 100 in regular 
code?  I just assume not.  But the standard is suggesting (only matching 
rank) it should be called to finalize a vector

TYPE(mytype) :: vector(100)

which is what I mean.  So I thought about warnings for defining a 
procedure with explicitelly shaped arguments FINAL (but for those 
without ELEMENTAL/matching rank procedures I like the idea, too).

Daniel

-- 
Done:     Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal
Underway: Ran-Gno-Neu-Fem
To go:    Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou



More information about the Fortran mailing list