Malcolm Cohen wrote:
> >subroutine zero (number, doit)
> > integer, intent(out) :: number
> > logical, intent(in) :: doit
> >
> > if (doit) then
> > number = 0
> > end if
> >end subroutine zero
> >
> >The problem is with 'number'. Is intent(out) correct, because it's never
>
> It certainly is free to do that - the actual argument associated with "number"
> becomes undefined on invocation of "zero". If you want to preserve the
> previous value you must use either INTENT(INOUT) or no INTENT.
>
No INTENT is the same as INTENT(INOUT), though, and it also documents that the
arg. is part of the call list. Is there any reason not to include it, then?
(Not being pedantic - actually curious...)
Alvaro Fernandez
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|