aliased intent(in out) arguments
beliavsky_at_aol.com
Date: 10/26/04
- Previous message: Stig Kildegård Andersen: "Re: Best number crunching solution under $10,000 ?"
- Next in thread: James Giles: "Re: aliased intent(in out) arguments"
- Reply: James Giles: "Re: aliased intent(in out) arguments"
- Reply: *** Hendrickson: "Re: aliased intent(in out) arguments"
- Reply: Richard E Maine: "Re: aliased intent(in out) arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Oct 2004 21:56:26 -0700
Is the program below standard-conforming Fortran 95? A subroutine with
two intent(in out) arguments is called with both arguments being the
same variable. None of the Windows Fortran 95 compilers I tried
complain and simply print i=3 at the end.
This test program is motivated by a Usenet posting of Alex Martelli
with subject "Re: By value or by reference" in comp.lang.python at
http://groups.google.com/groups?q=fortran&hl=en&lr=&group=comp.lang.python.*&c2coff=1&scoring=d&selm=1glwh14.11nk6427up7a6N%25aleaxit%40yahoo.com&rnum=5
.
module foo
implicit none
contains
subroutine incboth(i,j)
integer, intent(in out) :: i,j
i = i + 1
j = j + 2
end subroutine incboth
end module foo
program xinc
use foo, only: incboth
implicit none
integer :: i
i = 0
call incboth(i,i) ! same variable for 2 intent(in out) arguments
print*,i
end program xinc
- Previous message: Stig Kildegård Andersen: "Re: Best number crunching solution under $10,000 ?"
- Next in thread: James Giles: "Re: aliased intent(in out) arguments"
- Reply: James Giles: "Re: aliased intent(in out) arguments"
- Reply: *** Hendrickson: "Re: aliased intent(in out) arguments"
- Reply: Richard E Maine: "Re: aliased intent(in out) arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]