3 ms·
Almost as good as Microsoft Office's tristate enum with 5 states (three of them not supported), where 0 is False and -1 is True: http://msdn.microsoft.com/en-u
by beambot 14y ago
Almost as good as Microsoft Office's tristate enum with 5 states (three of them not supported), where 0 is False and -1 is True:
http://msdn.microsoft.com/en-us/library/aa432714(office.12).aspx http://msdn.microsoft.com/en-us/library/aa432714(office.12)....
- matwood 14y agoObviously tri-state refers to False, True and Not Supported. :)
- gcv 14y agoSir, you owe me a new keyboard.
- mahmud 14y agoSome idiot is probably using booleans in some magic "arithmetic". A collegue once told me returning 1 for truth was handy because he could sum the results after a map, and compare the sum to the count of input elements to see if all succeeded. This only slightly more "handy" than returning TRUE and ANDing the result because you can say "X/N succeeded" (leaving the user to wonder which N-X failed is fine, I guess.)
- pcwalton 14y agoThis is how Visual Basic 6 and below worked; True was -1 and False was 0, so that bitwise and logical operators could be unified.
- astrodust 14y agoPresumably this is because -1 is all bits on in two's complement (http://en.wikipedia.org/wiki/Twos_complement http://en.wikipedia.org/wiki/Twos_complement).