(j3.2006) lower bounds of results of array valued functions
Bill Long
longb
Sun Jul 26 22:02:31 EDT 2009
Malcolm Cohen wrote:
>
> (And I don't think we're going to be changing the definition of whole
> array any time soon.)
I would not expect a change to "whole array". That would have side
effects elsewhere. However, the possibility of allocable function
results did not exist when the lbound() rules were made 20 years ago.
The issue here is what the rules for lbound() should have been in light
of that change in f03. Perhaps "whole array or function result that is
allocatable or pointer" would be an alternative. That version is easier
to implement, and more consistent with the way we treat arguments.
>
>> I would expect the descriptor for the result of H() to be passed to sub,
>> and 5 printed.
>>
> That's not what we decided, and not what the standard says.
So far I have not found a compiler that agrees with this interpretation.
Even the one that printed 1 for the expression cases printed 5 in sub.
>
> "allocatable" is an attribute that is only possessed by variables. The
> return value of an allocatable array function is just an array value -
This sounds entirely logical and reasonable. And yet we specifically
discuss the "allocatable result" and specify exactly when it is
deallocated. You can't deallocate something that is not allocatable, so
the idea that the result is not allocatable seems to contradict
[130:27-30]. I don't think Bob is off the mark in suggesting there are
ambiguities here.
Cheers,
Bill
> which must be entirely defined, just like any other nonpointer
> function. The only material difference between an allocatable array
> function and an ordinary array function is that you don't have to decide
> on the size of the result on entry to the function, and you can change
> your mind during execution of the function. That is just about it.
>
> Cheers,
--
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