Peter Shenkin writes:
> As far as determining the size of the LOGICAL KINDs one has found,
> the only way I can think of for doing this is to declare an array
> of them, pass the first and last elements to a C function, and
> subtract addresses. Is there a better way?
The "usual" answer to finding sizes of things is to use
INQUIRE(iolen=...
Be sure to use a large enough array that you don't run into
problems with minimum record sizes. I'd make sure I had at
least 32 bits - an array of 32 logicals ought to do. Some systems
might not do records shorter than 32 bits - particularly systems
that measure record lengths in terms of 32-bit words.
Which, of course, brings up the other "issue" with using INQUIRE
for this. You get the answer in processor-dependent units. I think
that every f90 processor out there has at least an option to make
the units bytes, but if you don't want to count on that, then it
shouldn't be too hard to calibrate the units by doing an inquire
on something of known size. Perhaps an array of integers. You
can determine the size of integers in any number of ways, one being
the bit_size intrinsic. (I'd think it convenient if bit_size worked
on things in addition to integers - but it doesn't).
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|