------- Comment #5 from burnus at gcc dot gnu dot org  2010-09-20 07:56 -------
(In reply to comment #0)
> In gfortran a WRITE of a NAMELIST group into an internal file appears to all
> go into the first record.
> only major complaint with that is that I first guessed that your output
> into an internal file would be formatted just like it was to stdout.
> But gfortran output to stdout or to a file writes in a very different format,
> putting one keyword=value per line (which I like, but is also not required by
> any standard requirement I can find).

If you use a scalar string, there is only a single record - thus gfortran has
no choice then using only one record. You could instead use a character array,

character(30) :: str(6)
integer :: a, b, c, d
namelist /nml/ a,b,c,d
str = ''

>From the F2008 standard:
"If the file is a scalar character variable, it consists of a single record
whose length is the same as the length of the scalar character variable. If the
file is a character array, it is treated as a sequence of character array
elements. Each array element, if any, is a record of the file."

(In reply to comment #4)
> This issue, line ending for namelist to character arrays, has come up before. 
> I don't remember the outcome of that previous discussion.  I will research a
> little.

Well, in gfortran character arrays seem to do what urbanjost would like to
have: A new record for each namelist element.



Reply via email to