Re: recl on g95 and gfortran
- From: beliavsky@xxxxxxx
- Date: 28 Jun 2006 05:17:49 -0700
Arjen Markus wrote:
beliavsky@xxxxxxx schreef:
For the following program compiled and run on Windows XP
program xrecl
For both compilers, the first line in file xrecl.dat contains a space
followed by "24" (no quotes in file), followed by a newline.
Are both compilers conforming to the standard?
If I read this program correctly, then you are using RECL= on
a file that is not accessed as a direct-access file. I thought
that was only allowed for direct-access?
But if it is allowed, then there could be another explanation:
The unit of RECL is compiler (processor-) dependent. It could
be that g95 uses a single byte as the unit and gfortran uses
a word (4 bytes usually) as the unit. In the latter case, the
record would consist of 4 characters and that is within
the limits of the file you are reading.
Thanks for your reply.
Richard Maine wrote in a 2002 comp.lang.fortran thread
"OPEN(...,RECL=nnn,...) means DIRECT ACCESS, implicitly ?", that in
Fortran 77 it was "illegal to specify recl without also specifying
access="direct".'" but that
'In f90, you can use recl with sequential files, and it means that the
file must support
records at least that long. Note, while we are on the subject, that
specifying recl for a sequential file does *NOT* guarantee that you
won't write records longer than that (for example, it does not
necessarily have any effect on list-directed and namelist I/O, though
it is allowed to). It just means that the file must support records
at least that long. The exact wording of the standard says that
the file is created "with a set of allowed record lengths that
includes the specified value".'
This is consistent with what the Fortran 95 handbook says. So I think
recl is allowed on sequential files in F95.
.
- Follow-Ups:
- Re: recl on g95 and gfortran
- From: Michael Metcalf
- Re: recl on g95 and gfortran
- References:
- recl on g95 and gfortran
- From: beliavsky
- Re: recl on g95 and gfortran
- From: Arjen Markus
- recl on g95 and gfortran
- Prev by Date: Re: automatic variables are not initialized correctly?
- Next by Date: Re: CVF compiler question, program giving inconsistent results
- Previous by thread: Re: recl on g95 and gfortran
- Next by thread: Re: recl on g95 and gfortran
- Index(es):
Relevant Pages
|
|