> [Alvaro] "Allocated" is being used here in the sense of "memory is set
> aside for the array so that it can be referenced." Thus, allocated in
> the generic sense, not in the restricted Fortran 90 sense.
you mean stack allocation, right... well for a dummy argument there is
no stack allocation. the compiler assumes that the memory for it has
already been allocated previous to the call to the subroutine
> [Alvaro] I meant: _when_ does the compiler _set aside memory_ for this
> array? Does it do so at procedure entry, but not make it available
> unless the argument is present? Or does it wait until I check for the
> argument's presence and set it aside then only if the argument is
> present? Or - does it do something undefined because I have confused it?
see above. you have to think of it as passing a reference to the
argument that actually copying in and copying out (well... for most
cases, unless you are passing non-contiguous array sections when the
compiler will create a memory location for a new array, copy the
non-contiguous section to the new array and then pass the reference to
the new array to the subroutine and then after returning from the
subroutine will copy the new array back to the non-contiguous array...
this is compiler dependent... but still no memory allocation for the
dummy argument inside the subroutine)
> [Alvaro] Perhaps it has been the compilers I have dealt with, but
> without the reference being inside a check using PRESENT, I find I can't
> reference the argument, whether present or not. But that's another
> issue.
try to reference an optional argument when its not present will lead to
the program crashing. your compiler is being smart by not letting you
refer to it outside such a if (present...) block.
renchi
|