Hacker News new | ask | show | jobs
by cpeterso 958 days ago
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...

2 comments

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.