Comment by BuyMyBitcoins
Comment by BuyMyBitcoins 9 hours ago
I am surprised at common it is for software engineers to not treat booleans properly. I can’t tell you how many times if seen ‘if(IsFoo(X) != false)’
It never used to bug me as a junior dev, but once a peer pointed this out it became impossible for me to ignore.
The most egregious one I saw, I was tracking down a bug and found code like this:
And of course neither branch was hit, because this is C, and the uninitialized x was neither 0 nor 1, but some other random value.