Dear Nils:
Nils Smeds wrote:
<snip>
> It turns out that the Fortran 95 standard explicitly says that a dummy argument
> can not have the ALLOCATABLE attribute. So much for that good idea of mine. I
> have come to the conclusion that I could do:
>
> 1) In the module I can define a module procedure that deallocates/reallocates
> through host association. Or I could use associate the array to a procedure
> that does the assertion/expansion.
>
> 2) I could make the dummy argument a POINTER array and the base array a TARGET
>
<snip>
>
> In F2K I assume that I could tie such a verify/expand subroutine to a
> base type and derive my arrays from that type.
>
> --
>
> I have two questions:
>
> Firstly: Does anyone know what lies behind the standard explicitly stating that
> a dummy argument must not have the ALLOCATABLE attribute? I am having problem
> seeing good reasons why the restriction would be necessary. At least in the
> sense that a compiler can take much use of this. Any function and or subroutine
> call (that is not pure) can still have the side effect that arrays move in memory
> or expand/shrink since it is possible do it by host/use association.
>
> Secondly: Have anyone made investigations as to what extent POINTER and TARGET
> attributes affects the optimizing compilers on the market?
>
> Best regards,
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Nils Smeds (formerly Jönsson) http://www.pdc.kth.se/
> Center for Parallel Computers e-mail: [log in to unmask]
> Royal Institute of Technology Voice: +46-8-7909115
> KTH Fax: +46-8-247784
> S-100 44 Stockholm, Sweden Office: OB2, room 1546
> -----------------------------------------------------------------------
F2K removes the restrictions on ALLOCATABLE completely. In F2K, you will be able
to have ALLOCATABLE objects in these circumstances:
1. As dummy arguments.
2. As function return variables.
3. As components of derived types.
These ALLOCATABLE extensions were defined in an ISO Type 2 Technical Report (TR),
which is now published. By ISO rules its contents will be incorporated into F2K
completely and automatically unless implementation experience shows that technical
changes are needed.
I am not sure what the reason was for the original restrictions on ALLOCATABLE; I
was not on J3 at the time F90 was developed. From what I have heard (second and
third hand), it was believed that allowing ALLOCATABLE data objects in these three
cases caused some serious implementation difficulties for vendors. Since one could
get the same functionality using the POINTER facility, it was originally thought that
having ALLOCATABLE objects in these cases was unnecessary.
Recent experience has shown that ALLOCATABLE is a lot easier for users to
understand and use in these three cases than is POINTER, therefore the TR. And,
vendors have found out that the implementation difficulties are not that great; the
usual method is to recognize the syntax and use the POINTER facility in these three
cases behind the curtain.
I welcome any additions or corrections to my explanation.
--
----------
Sincerely,
Craig T. Dedo Internet:
[log in to unmask]
Elmbrook Computer Services Voice Phone: (262) 783-5869
17130 W. Burleigh Place Fax Phone: (262) 783-5928
Brookfield, WI 53005-2759 Disclaimer: These opinions are mine
alone.
USA They do NOT represent any
organization.
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin (1759)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|