Re: True = -1 ?
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Wed, 11 May 2005 19:18:46 -0500
"Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx> wrote
> I can't for the life of me understand why he continues to call VB's AND, OR,
> XOR, etc. operators *logical*. They are bitwise, and that is why True should
> be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it
> wouldn't matter if True was -1 or 1, or 45 for that matter.
I've always thought he's confused the issue, myself. But, I approve of calling
them logical operators because they correspond to the named 'logic' gates found
in electronics. Individual gates typically act on individual bits....
What I didn't like was the (abstracted) distinction between logical operations, and
boolean tests:
<quote>
First, understand that logical operations and tests are two different things.
For tests only (that is, the expression tested by IF and whatnot), a zero value
is judged to be false, any nonzero value is judged to be the truth (well, True).
</quote>
The sentence, "For tests only..." is clearly a misleading statement:
Debug.Print CBool(1)
Where is there any sort of 'test' in that??? Yet it results in a True or False result
depending on the numerical value used....
A more concise explaination:
VB's logical operations yield numerical results based on bitwise comparisons. If the
result is not 0, then it is regarded as being True. VB's value of True is an Integer
based on the result of the logical operation: X = Not False.
That is all there needs to be said on that topic.
LFS
.
- Follow-Ups:
- Re: True = -1 ?
- From: Dan Barclay
- Re: True = -1 ?
- From: Jonathan Wood
- Re: True = -1 ?
- References:
- True = -1 ?
- From: Chris Lieb
- Re: True = -1 ?
- From: Karl E. Peterson
- Re: True = -1 ?
- From: Jonathan Wood
- True = -1 ?
- Prev by Date: Re: I need to develop an xsl stylesheet designer
- Next by Date: Re: Help! - Can't figure out FaxCOMEXLib!
- Previous by thread: Re: True = -1 ?
- Next by thread: Re: True = -1 ?
- Index(es):
Relevant Pages
|