Home » , » How Do I Become Warning Free?

How Do I Become Warning Free?

If you�re starting a new project from scratch, writing warningfree code is easy. But if you�re starting from an existing codebase, it can be much less straightforward. The chances are that the first time you increase your compiler�s warning level or run a new tool, you will disappear under a tidal wave of warnings. Often these result from systemic issues with the code�common mistakes you�ve made over and over again, which have gone unnoticed until now, but each instance of which generates a warning. There are also issues that tend to �percolate� through the code generating many warnings (const-correctness in C++ is a classic example).

The solution is to be pragmatic. Most static analysis tools provide fine-grained control over which warnings are generated where (via comments embedded in the source code, for example). Very often you can get the number down to a manageable level by switching off the one or two warnings that account for the majority or by excluding a �problem� module. You can go back and fix these other warnings at a later date, but you gain most of the benefit of static analysis in the interim.

The same approach can help on the rare occasions where a buggy tool generates spurious warnings for legitimate code, where you knowingly choose to write �questionable� code, or where a third-party library generates warnings.

Source of Information :  Paul Butcher - Debug it Find repair and prevent bugs
Jika Anda menyukai Artikel di blog ini, Silahkan klik disini untuk berlangganan gratis via email, dengan begitu Anda akan mendapat kiriman artikel setiap ada artikel yang terbit di Creating Website
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Information Computer and Technology - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger