Don’t tolerate compiler warnings

Wednesday, 22 October 2003

All code must compile without warnings. All warnings must be fixed before checking code in to a version control system. This applies not only to compiled languages: for example, validation of HTML or CSS code should also be warning-free for the same reasons given here.

I have worked on a project where nightly builds would yield thousands of warnings. We knew most of these were harmless, but reviewing the output manually was out of the question. We had to write scripts to attempt to extract errors and important warnings from the output file every morning. I hate to think how many important warnings we missed.

If code normally compiles with no warnings, then it’s trivial to tell if there’s something suspicious going on. Don’t let the harmless warnings build up, or you’re more likely to miss dangerous warnings.

Tags:

Leave a comment