Re: End of record marker - 32 vs. 64 bit
- From: "Steve Lionel" <steve.lionel@xxxxxxxxx>
- Date: 28 Feb 2007 10:14:08 -0800
Chris Theis wrote:
I'm currently dealing with some questions regarding unformatted binary files
on 32 & 64 bit platforms, and probably one of the experienced FORTRAN
programmers might be able to shed some light on this issue. AFAIK records
are delimited by record length markers which are of the size of an integer.
On a 32 bit machine this will be 4 bytes, whereas on a 64 bit machine it
will give me 8 bytes.
Not correct. On the majority of 64-bit systems you are likely to
encounter, the size of an integer is still 32-bits. There will likely
also exist a 64-bit integer kind, but "default integer" is still 32-
bits on the majority of implementations I am aware of.
This does not have a direct bearing on the on-disk record layout for
unformatted files.
My question is whether the record
length marker is specified to be of integer size in the standard or what the
FORTRAN standard says on this issue?
The Fortran standard is completely silent on this issue. It is an
implementation detail, and there exist platforms (VMS is one that
comes to mind) where record lengths are handled by the file system and
not written out as data. It is true that across UNIX, Linux and
Windows compilers, the use of record lengths in the data is very
common, but it is not universal nor is it specified by the standard.
You say you are using g77. I am aware that g77 made the unfortunate
choice of using straight 64-bit record lengths on platforms with 64-
bit virtual addresses. As you discovered, this makes that combination
incompatible with platforms that use 32-bit lengths. I don't know if
g77 has an option to use 32-bit lengths. I do know that Intel
Fortran, DEC/Compaq Fortran and gfortran use a scheme where 32-bit
lengths are used and very long records are split into segments with
specially encoded length values. This preserves compatibility with 32-
bit platforms for nearly all cases, but still allows longer records to
be written and read. I think that gfortran, which recently switched
to the segment scheme, has an option to use 64-bit lengths.
I'm not sure why you feel you are locked to g77.
Steve
.
- Follow-Ups:
- Re: End of record marker - 32 vs. 64 bit
- From: Richard Maine
- Re: End of record marker - 32 vs. 64 bit
- From: Chris Theis
- Re: End of record marker - 32 vs. 64 bit
- References:
- End of record marker - 32 vs. 64 bit
- From: Chris Theis
- End of record marker - 32 vs. 64 bit
- Prev by Date: Re: Array Constructors
- Next by Date: Re: Array Constructors
- Previous by thread: End of record marker - 32 vs. 64 bit
- Next by thread: Re: End of record marker - 32 vs. 64 bit
- Index(es):
Relevant Pages
|