On Apr 4, 2017, at 10:55 AM, Clive Page <[log in to unmask]> wrote:
> On 04/04/2017 13:57, Vipul Parekh wrote:
>> You must have considered the possibility where "to specify that your
>> variables used in the I/O lists have a specific length in bits", one can
>> build on Robin Vowels comment about using CHARACTER variable(s) for IO
>> but employ CHARACTER_STORAGE_SIZE named constant from ISO_FORTRAN_ENV to
>> get at the desired length(s) in bits (this is as opposed to assuming it
>> will be 8 bits). TRANSFER intrinsic then helps with the actual
>> variables. Do you anticipate any shortcomings in this approach relative
>> to your use cases?
>
> Well you can do that, but it seems awfully indirect and inefficient to me, compared to simply using a regular READ statement with an I/O list containing real or integer variables declared to have the required size in bits. And if it turns out on some system that CHARACTER_STORAGE_SIZE is not 8 bits, then the indirect route can get even more complicated.
>
I agree with Clive on this issue. Resorting to TRANSFER is too much of an obfuscating kludge for me.
> Perhaps the only case in which it can be useful to go via bytes (which is what you really want but have to use CHARACTER as a substitute in Fortran) is if you are reading a big-endian file on a little-endian computer or vice-versa.
>
Many vendors provide a mechanism (as an extension) for endian conversion when moving data to or from a file. Perhaps standardizing an OPEN statement specifier for this could be proposed for the next revision.
Cheers,
Bill
> Regards
>
>
> --
> Clive Page
Bill Long [log in to unmask]
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
|