(j3.2006) Finalizing subroutines question
Bill Long
longb
Fri May 23 13:24:02 EDT 2008
Aleksandar Donev wrote:
> On Friday 23 May 2008 08:13, Jim Xia wrote:
>
>> The finalizer, t_finalize, will be called in this case, but it wouldn't be
>> a legal program because of the rules in the argument association: the
>> actual argument is an array of 5 elements and the dummy is expecting an
>> array at least 100 elements.
>>
> We already discussed this on this list, see thread "finalizer infelicity"
> started by Michael on 11-21-2007. Apparently, Jim's answer is what the
> standard says. It may have even be the indended answer.
> It sure is a ridiculous idea to even allow codes like that to be written and
> then be so mysteriously "illegal".
> The bottom line is, users should not use explicit-shape arrays in their
> finalizers, even if for some unknown reason the standard allows that.
> Assumed-shape or size would be much better. Or even better, elemental
> finalizers so that they apply to all ranks.
> Aleks
>
I agree with Aleks that an explicit-shape array as the dummy argument in
a final subroutine is generally not a good idea. Maybe OK if, for some
reason, you know by design that the objects of the type are always
arrays of a particular length. But, I would expect that to be a really
rare case.
The standard is written to be flexible here. Flexible sometimes means
"more barrels on the gun aimed at your foot". So far, very few users
have been writing final subroutine. When they do, I'm expecting this
part of f03 to be in the "high learning curve" bin.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the J3
mailing list