Re: Derived type argument to subroutine
- From: Dan Nagle <dannagle@xxxxxxxxxxx>
- Date: Thu, 17 Apr 2008 13:20:20 GMT
Hello,
You are very badly confusing mechanism
with effect.
Argument association, as it's called, is
a set of rules regarding the relationship
between actual arguments and dummy arguments.
Said rules are specified.
The mechanism by which those the relationship
is made to occur is not specified.
An applications programmer is entitled
to use the specified rules as needed.
The compiler is entitled to create
the illusion as it prefers.
Endit. :-)
On 2008-04-17 08:12:49 -0400, Arno <arnoinperu@xxxxxxxxxxx> said:
1. The standard does not specify that *ANYTHING* is passed by reference.
In practice, they often, but not always are.
I also thought that in Fortran the default was passing arguments by
reference and that passing by value has to be explicitely stated. I
also thought that an argument changed in a subroutine is changed in
the caller as well. I make pretty often use of that, so I really hope
I can rely on the fact that arguments are passed by reference.
See for instance below:
program test
integer :: i
i = 2
call mycalc(i)
write(*,*) i
end program
subroutine mycalc(val)
integer :: val
val = val*2
end subroutine
Would the printed value always be 4, or is it undefined as the passing
of arguments can be either by reference or value, dependent on
compiler, platform etc.!?
Arno
--
Cheers!
Dan Nagle
.
- Follow-Ups:
- Re: Derived type argument to subroutine
- From: glen herrmannsfeldt
- Re: Derived type argument to subroutine
- From: Arno
- Re: Derived type argument to subroutine
- References:
- Derived type argument to subroutine
- From: Gib Bogle
- Re: Derived type argument to subroutine
- From: Richard Maine
- Re: Derived type argument to subroutine
- From: Arno
- Derived type argument to subroutine
- Prev by Date: Re: Is this standard-conforming code?
- Next by Date: Re: Can someone know the time for a oo implemented F2003 complier release under the window platform?
- Previous by thread: Re: Derived type argument to subroutine
- Next by thread: Re: Derived type argument to subroutine
- Index(es):
Relevant Pages
|