From: Richard Maine on
Eli Osherovich <eli.osherovich(a)gmail.com> wrote:

> On Jul 10, 11:29 pm, nos...(a)see.signature (Richard Maine) wrote:
> > Eli Osherovich <eli.osherov...(a)gmail.com> wrote:
> > > Now, according to the Fortran standard, any allocatable
> > > output argument becomes deallocated upon the function call. Hence, if
> > > I want to avoid unnecessary allocations I declare the argument to be
> > > "in out" which does not reflect its actual status.
> >
> > > So, can somebody explain me the reason to deallocate output argument?
> >
> > Because that's what intent(out) means - that no information comes in
> > from the argument. It is only used to send information out.
[elaboration elided]

> Thank you very much for your explanation.
> Now it makes more sense.

You're welcome. But now, having explained that, let me throw a little
wrench into the works by pointing out that things aren't always quite as
consistent as my elided explanation might lead one to believe. :-(

There are two cases where an intent(out) argument can be used to bring
information into a procedure. I see why those cases need to be that way,
but still I note them as oddities.

Those two cases are assumed-shape arrays and assumed-length characters.
In those cases, the shape or length information comes into the
procedure, even if the argument is intent(out). It pretty much "has" to
be that way because there is no way to set the shape or length within
the procedure. Even if there was such a way and one interpreted it as
being like the way that you can set the shape or length of an
explicit-shape/length dummy, that would contradict the concept of
assumed shape or assumed length.

So it is possible to write a procedure whose results depend on values
obtained from intent(out) arguments. I find that a little idiosyncratic.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
First  |  Prev  | 
Pages: 1 2
Prev: IDE for ifort on Linux
Next: a weird COMMON fact