@Cthulhu said:
This isn't that strange. The coder might think it is impossible for k to be zero at that point, but they realize that what they think is impossible and what actually is impossible may be different. If they are right then that println will never be run, no harm done. But if they are wrong then the println assures they will find out soon enough which may save a whole load of debugging.
That doesn't wash with me... we're supposed to be professionals and a simple unit test would have proven that it couldn't/could happen.
Whats worse is that nothing is done about it except to print a statement saying it's impossible.
the following code would give you the same logic:
if (k != 0) { ... }
If I wasn't so lazy I'd have back tracked who added this code to the repository... so at least so I could show them that it made it onto the Daily WTF.
Alas, I am lazy...