When experimenting I often use if (true) {..}
or if (false) {..}
to section off chunks of code I'm playing with.
The problem is that compilers these days sometimes issue a warning about unreachable code. I then have to promote my code to something like if ((10 % 2) == 0)
, but then some smarter compilers catch this as unreachable too.. (And so a small arms race begins..)
I'd like to catalogue the standard expressions (across many languages) which will always return true or false, and which the compiler is unable to statically warn me about. Can you tell me any?