Analyzing your C++ code
Static analysis of C++ code is a feature offered by VS Express and the premium editions of Visual Studio. Static analysis is a useful way to locate potential problems in your code and provides a way to catch a wide range of problems early in the development cycle.
In this recipe, we will show you how to use Visual Studio's built-in static analysis tools.
Getting ready
Start Visual Studio and create a new Empty Project under Visual C++, giving it a name of your choice.
How to do it…
For this project, perform the following steps:
Right-click on the project and select Properties.
Navigate to Configuration Properties | General, change Configuration Type to Static Library (.lib), and click on OK.
Add a new Header File to the project and name it
AnalyzeThis.h
.Enter the following code in the body of the header file:
class AnalyzeThis { public: int LookHere(int param); };
Add a new C++ File to the project and name it
AnalyzeThis.cpp
.Enter the following code in the body of the file...