I was looking at some C++ code and found the following construct:
if('A' == 0x41) {
// ...
} else if('A' == 0xc1) {
// ...
} else {
// ...
}
I get a Visual Studio warning saying:
Warning C4127 conditional expression is constant.
Visual Studio is clearly right - surely 'A' is defined to be 0x41. Why is the author writing this code, given that two out of the three branches are dead code?