Zero-warning compilation

Compiling a large system with zero warnings adds to confidence that nothing has broken — The more warnings enabled the higher the confidence.

The problem with warnings during compilation is that yet another warning is not easy to spot, and that warning may actually be important.

Simple method

Set up automatic compilation with all warnings enabled and record number of warnings and lines of code for each source file. Totals can be calculated from these. Track these numbers over time.

Whenever checking in modified source files, the amount of warnings must never increase (reject check-in if it does) — New source files should have zero warnings from the start.

Over time the amount of warnings will decrease and code quality increase. Remember to visualize progress so the improved quality becomes apparent — It’s good motivation to see the code improves.

Of course the above method can be refined in various ways, but the basic principle should hold.

Leave a Reply