Derived type argument to subroutine



My question is motivated by concern about performance. I assume that when I pass a variable that is a derived type as an argument to a subroutine, is it passed by reference, just as fundamental types are. Am I correct? For example (in a module):

type mytype
integer :: x,y,z
real :: w(1000)
end type

type(mytype) :: a
a%x = 1
a%y = 2
a%z = 3
call init(a)
....

subroutine initw(a)
type(mytype), intent(inout) :: a
a%w = 99
end subroutine
.



Relevant Pages

  • Re: Using unused variables
    ... subroutine itself uses a SELECT CASE to dispatch the initialization to ... arg1, ..., argN may be anything ... should store them in a derived type, ... I increasingly use keyword arguments to improve documentation, but I usually avoid incorporating relatively short argument lists in derived types because it forces setting of components on separate lines rather than directly in the argument list. ...
    (comp.lang.fortran)
  • Re: Some question to sequence and deallocating arrays
    ... I suppose it is worth noting that the derived type I/O feature of f2003 ... There are some other arguments to the subroutine; ...
    (comp.lang.fortran)
  • Re: a flexible number of derived type
    ... I'd like to define a derived type training_class which has flexible no. ... It turns out the statement of the allocating memory is very long. ... end program test ... subroutine allocate_Training_class ...
    (comp.lang.fortran)
  • Re: Guidelines/checklist for reviewing code
    ... I've heard of rules like this before, and I disagree - somewhat ... I think this description leads to practices that I think are poor. ... used in a particular subroutine call, and throwing those things into a ... the determining factors for defining a derived type have far more ...
    (comp.lang.fortran)
  • Re: Some question to sequence and deallocating arrays
    ... I suppose it is worth noting that the derived type I/O feature of f2003 ... There are some other arguments to the subroutine; ...
    (comp.lang.fortran)