From: "Clive Page" <[log in to unmask]>
Sent: Wednesday, April 05, 2017 1:55 AM
> 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.
>
> 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.
Using CHARACTER is necessary for processing picture files,
as the file size is not often exactly divisible by 4 or 8.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|