(j3.2006) Interp F03/0096: possible addition or a new interp

Dick Hendrickson dick.hendrickson
Fri Dec 14 12:24:14 EST 2007


Recently there was a long discussion on comp.lang.fortran about an
internal WRITE where the internal unit appeared in the
I/O list.  The example is something like

      character(10) string
      string = "x"
      write(string, fmt="(A,A)") "AAA", trim(string)

Some compilers produce AAAx as the result, others AAAAAA.  The first
ones apparently evaluate trim(string) before storing the AAA into it,
the others apparently store AAA into string before evaluating
trim(string).

Which is the correct behaviour?

Page 196, line 28 of F2003 says
"If an internal file has been specified, an input/output list item shall
not be in the file or associated with the file."

That covers the intent, but the words are wrong.  "trim(string)" isn't
in string. It's not "associated" with string if associated means any of
the list of things in 2.5.3.

I don't think you can just add "must not appear" to the prohibitions;
that would disallow simple things like KIND(string), which are harmless.

To me, this seems like another case of what interp 96 is about.  But,
it could just as easily become a new interp.

Dick Hendrickson




More information about the J3 mailing list