Re: printing logical variables as "true" and "false"
- From: "David Flower" <DavJFlower@xxxxxxx>
- Date: 29 Nov 2005 00:46:18 -0800
Ron Shepard wrote:
> In article <1h6r61b.1dl9q5f1btrvlsN%nospam@xxxxxxxxxxxxx>,
> nospam@xxxxxxxxxxxxx (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.
>
> However, in hindsight things would sure have been easier over the
> past 25 years if the standard did specify this kind of mapping. Or
> if LOGICAL were treated as a 2-value subset of INTEGER. That way,
> you could use logical variables as, for example, array indices,
> do-loop indices, and so on.
>
> $.02 -Ron Shepard
Whilst this would have advantages, there is are significant downsides:
- some coding errors would not be identified
- there is a problem in situations like:
INTEGER I
DO I = 0, 2
IF ( I ) THEN
How does the compiler treat I=2 ? Does it:
a) Error (involving extra code)
b) Just look at the LSB
c) Something else
- Does I = .TRUE. set the LSB or I=1 ?
Dave Flower
.
- Follow-Ups:
- Re: printing logical variables as "true" and "false"
- From: Ron Shepard
- Re: printing logical variables as "true" and "false"
- From: Nestor Grion
- Re: printing logical variables as "true" and "false"
- From: [JvO]
- Re: printing logical variables as "true" and "false"
- References:
- printing logical variables as "true" and "false"
- From: beliavsky
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- Re: printing logical variables as "true" and "false"
- From: *** Hendrickson
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- Re: printing logical variables as "true" and "false"
- From: *** Hendrickson
- Re: printing logical variables as "true" and "false"
- From: James Van Buskirk
- Re: printing logical variables as "true" and "false"
- From: Nestor Grion
- Re: printing logical variables as "true" and "false"
- From: Richard Maine
- Re: printing logical variables as "true" and "false"
- From: Ron Shepard
- printing logical variables as "true" and "false"
- Prev by Date: Re: "USE MATLAB" writing at the end of the lines
- Next by Date: Re: Some formatting problems
- Previous by thread: Re: printing logical variables as "true" and "false"
- Next by thread: Re: printing logical variables as "true" and "false"
- Index(es):