AndAlso and OrElse are not bitwise like AND and OR. They function like boolean operators, and even return Booleans when used with Boolean values.
Should we have something similar for NOT?
Not is currently a bitwise compliment. Should we have a not operator that always returns a -1 or 0 (TRUE or FALSE)? If so, what do we call it? ButNot?
NOT operator like AndAlso/OrElse?
Re: NOT operator like AndAlso/OrElse?
You could say that "= 0" or "= false" is that operator. That's what I ended up doing anyways.
Re: NOT operator like AndAlso/OrElse?
Sure, that is an easy work around. I was just curious if it would be a good idea to have something similar to the short-circuit ops to be consistent.dkl wrote:You could say that "= 0" or "= false" is that operator. That's what I ended up doing anyways.
Re: NOT operator like AndAlso/OrElse?
How about (single line) macros:They check whether 'expression' is: True/False ... ( IsFalse() is IMHO, more 'telling', than IsNot() )
Code: Select all
#Define IsFalse(e) ( Not CBool(e) )
#Define IsTrue(e) ( CBool(e) )