In VB6, coercing True
to an integer yields the value -1.
Why is this so? What is the reasoning behind this?
In most other programming languages (C/C++, Java, Perl, Python, etc.), true becomes 1 when coerced into an integer. In boolean algebra, the value 1 is used to represent true/on. Why does VB6 do it differently?
I do see a certain elegant symmetry in the fact that a bitwise-not of -1 (True) will yield 0 (False), and vice-versa (because of -1's representation being all 1s in two's complement), but I can't think of any practical benefits of this identity.
I'm only asking out of curiosity, by the way -- this was something that struck me as odd when I first learnt VB6, and I've been wondering ever since.