Date: Mon, 28 Mar 2005 14:21:10 -0700
From: James Giles <[log in to unmask]>
Do any of these compare instructions return an INTEGER valued
result? Is that INTEGER value either 0 or 1? I suspect not.
The Alpha integer compare instructions set the destination (integer)
register to 0 or 1. Alpha has 8 integer conditional branch and move
instrucitons for (6 compares with zero plus 2 low-bit). The Alpha
floating point compare instructions set the destination register to
0.0 or 2.0 and has 6 floating point conditional branch instructions
(the standard 6 compare-against-zero) and 6 corresponding conditional
IA64 does all comparisons to predicate registers. After that, you can
do whatever you wanted by predicating instructions.
Well, adopting C as an implementation language pessimizes the
system. In any case, C isn't zero or one, it's zero or non-zero.
No, the language says that the value of a comparison is zero or one.
It also says the test for if() and such is zero/non-zero.
But I still don't believe you set logicals *in hardware* to an
INTEGER 0 or 1. ...
Hardware supplies implementation techniques to be used by vendor
design decisions which must satisfy language standards. Some
hardwares may be in more alignment with particular languages than
other hardwares or languages. THIS IS WHY DEPENDING ON THE
UNSPECIFIED-BY-THE-LANGUAGE FORMAT OF THINGS IS A *BAD IDEA*. C tells
you what the result of a comparison is. Fortran does not say how
.TRUE. and .FALSE. are represented. End of story.
Once again, the language should *not* specify what the canonical
internal form of a LOGICAL should be. That is, the standard
document *should* be mute on the subject. Whatever you do as
implementors is your business. It should be your business. It
should not be the business of any language designer.
Since this is a Fortran discussion forum, I agree. Should you try to
broaden that statement to other languages, you will hit differing
philosophies and different historical precedents.