Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

target and pointer association

$
0
0

If you associate a pointer with a target in one scope (say a subroutine), and then use both in another subroutine, do you need to declare the dummy argument corresponding to the target with "target" attribute?

In other words:

real :: a(10)
real, pointer :: pa(:)

...

subroutine assoc(x,px)
real, target, intent(in) :: x(10)
real, pointer, intent(out) :: px(:)
px=>x
end subroutine assoc

subroutine bingo(x,px)
real, intent(inout) :: x(10) !should I declare x as "target" ?
real, intent(inout) :: px(:)

px=x+1
end subroutine bingo
....
call assoc(a,pa)
...
...
...
call bingo(a,pa)


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>