Re: printing logical variables as "true" and "false"



Richard Maine wrote:

You appear to be assuming things that the standard quite explicitly does
not guarantee. Specifically, you appear to be assuming that the
compiler's internal representation of .true. and .false. are the same as
the internal representations of the integers 0 and 1. This is *NOT* a
standard-conforming assumption and there have been plenty of compilers
where it was not the case. It might happen to work on a particular
collection of compilers; that might even happen to be most current ones
- I haven't checked. But I sure know that it isn't an assumption
justified by the standard.

It is 0 and -1 on the TOPS-10 Fortran compiler, and it would also convert between logical and integer, such that a logical expression would have the value 0 or -1.


-- glen

.


Quantcast