May 21, 2008
Is it OK to remove code you don’t understand?

No.

Should be obvious but we all do it. People are merciless (or, dare I say, reckless) when trimming Other People’s Code. I was reminded of this fact by a recently well publicized occurrence of let’s-just-remove-the-line-that-warns.

First of all let me just say, yes, you should always check your warnings. They are great for catching your own suboptimal programming practices. And in languages like C where there aren’t almost any foot-shooting prevention mechanisms built into the language, compiler warnings are a godsend (people invented lint for a reason). So it’s no surprise many programmers get indoctrinated at an early age not to ignore compiler/debugger warnings.

Unfortunately, sometimes one gets a little overzealous and removes a line, say, that makes a random number generator, um, random. Apparently such a line of code in the Debian SSL library was generating warnings and had to be silenced with prejudice.

So let this be my plea to the code-literate masses: “Do not remove code you don’t understand.”