> 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:
>
<stuff de;eted>
>
> 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.
You can do what you want with pointers. We were under intense pressure
to keep the language small and the first proposal when pointers were
added was to remove allocatables completely. They were retained in their
simplest form for the sake of those that do not understand pointers.
Since then, the performance advantages of allocatables has become
appreciated, and F2k will include allocatable dummy arguments and
structure components. So you will be able to do exactly what you want
in F2k. The feature only just 'missed the boat' for f95, and was deemed
so important that an ISO Technical Report that defines it in detail was
written. It includes a formal promise that the feature in f2k will be
exactly as in the Report unless problems are encountered in its
implementation.
The Nag compiler includes the feature and the second edition of
'Fortran 90/95 explained' by Metcalf and Reid has a chapter on it.
John Reid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|