From: "Neil Carlson" <[log in to unmask]> wrote:
...
> Aleksander's question reminded me of my nagging question about dummy
> arguments with the target attribute. My understanding is that the
> target attribute prevents copy-in/copy-out which would break aliasing
> established by a procedure. [...]
As a pragmatic matter, the implementations might simply avoid
copy-in/copy-out. But the standard doesn't require that. It merely
says that the association of the (properly declared) TARGET
attributed variable with the POINTER attributed variable
is preserved upon return. That could be done by copying the
return value of the TARGET attributed variable out, and then
adjusting the POINTER as appropriate.
> [...] My question is whether the TARGET needs
> to be specified for the entire call-tree (assuming all procedures are
> module procedures and hence have explicit interfaces). An example:
A TARGET attributed dummy may be associated by procedure call with
a non-TARGET actual argument. In that case, POINTER associations
made with that dummy during the execution of the procedure are not
preserved upon return. That's why I wrote the caveat above that the
TARGET attributed argument must be properly declared. Both the
actual and the dummy declarations must have the TARGET attribute.
--
J. Giles
|