For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2005 > Re: printing logical variables as "true" and "false"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: printing logical variables as "true" and "false"
David Flower

2005-11-29, 3:58 am


Ron Shepard wrote:
> In article <1h6r61b.1dl9q5f1btrvlsN%nospam@see.signature>,
> nospam@see.signature (Richard Maine) wrote:
>
>
> 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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com