For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2005 > ADVANCE='NO' and X format? Was Re: Some formatting problems









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ADVANCE='NO' and X format? Was Re: Some formatting problems
John Harper

2005-11-24, 9:56 pm

In article <1132780106.77052@bats.mcs.vuw.ac.nz>,
John Harper <harper@mcs.vuw.ac.nz> wrote:
>
>Pity the poor compiler-writers trying to make sense of the f95 conflict
>between "the file position is not changed" and "n characters forward
>from the current position"!


A test program briefer than my previous effort is this 3-liner:

WRITE(*,'(A,1X)',ADVANCE='NO') '"foo'
WRITE(*,'(A)') 'bar"'
END

After discussing ADVANCE='NO' in a write statement whose format ends
with X by email with Andy Vaught, I agree that his g95 treatment of it
is defensible, but I'm not sure that a different treatment isn't also
defensible. And I now suspect the same is true in f2003. Experimental
evidence of f95 ambiguity is that when I tried the above program with
the five compilers available to me, all on unix or Linux systems,
three (g95,Compaq,NAG) wrote "foo bar" and the other two (gfortran,Sun)
wrote "foobar".

It's presumably too late to fix the f95 standard. Do we need an interp
for f2003, preferably before compilers appear :-), and yet another
rewrite of ADVANCE and X format for f2008?

John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045
Steven G. Kargl

2005-11-24, 9:56 pm

In article <1132890405.847975@bats.mcs.vuw.ac.nz>,
harper@mcs.vuw.ac.nz (John Harper) writes:
> In article <1132780106.77052@bats.mcs.vuw.ac.nz>,
> John Harper <harper@mcs.vuw.ac.nz> wrote:
>
> A test program briefer than my previous effort is this 3-liner:
>
> WRITE(*,'(A,1X)',ADVANCE='NO') '"foo'
> WRITE(*,'(A)') 'bar"'
> END
>
> After discussing ADVANCE='NO' in a write statement whose format ends
> with X by email with Andy Vaught, I agree that his g95 treatment of it
> is defensible, but I'm not sure that a different treatment isn't also
> defensible. And I now suspect the same is true in f2003. Experimental
> evidence of f95 ambiguity is that when I tried the above program with
> the five compilers available to me, all on unix or Linux systems,
> three (g95,Compaq,NAG) wrote "foo bar" and the other two (gfortran,Sun)
> wrote "foobar".


Update your version of gfortran.

kargl[207] gfc4x -o z --version lkj.f90
GNU Fortran 95 (GCC) 4.2.0 20051124 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.

kargl[208] ./z
"foo bar"


--
Steve
http://troutmask.apl.washington.edu/~kargl/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com