We all know that in C# we can’t cast bool to int. I wanted to see what is the binary representation of true with bitmask, but I can’t use (bool & int).. I think the problem is the architecture desicion “true is true, not any number != 0” (C++) and I was wondering what the benefits of such an architecture are? What is so bad with the C true/false concept?
Share
It’s clearer to the programmer when an integer can’t be used for
trueorfalse.if (5 > 0)is easier to understand rather thanif(5)It’s the same reason why they don’t allow fall through conditions in switch statements. It’s too easy to make a mistake.