Hacker News new | ask | show | jobs
by wrs 963 days ago
I’ve been involved with systems where 0xffff… was canonical “true”, but not something as specific as 7! If you’re going to turn on more bits, why not all of them? Though I think this was because the NOT instruction was used for logical inversion, so the bit flip theory doesn’t apply.
2 comments

For example, the value of Visual Basic's "True" keyword is -1. This seems silly from the perspective of a C programmer, but -1 (0xffffffff) is "more true" than 1 because every bit is true, not just the LSB. :)

https://learn.microsoft.com/en-us/dotnet/visual-basic/langua...

Even in VB there is a grain of rationale .. I never even considered before WHY it was -1.. I always just thought it was VB doing VB, but now I have gained +1 respect for Vb..

Edit: "Gained" no "Earned"

In the long-ago world where integers were commonly used as arrays of bit flags, it made perfect sense that True = Not False.
The OP still wanted to only type a single character.