O'Reilly logo

Visual Studio 2013 Cookbook by Richard Banks, Jeff Martin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a custom rule set

The built-in rule sets that come with Visual Studio cover a variety of usage scenarios and provide a way to use the Code Analysis tool in your projects immediately. Of course, depending on the complexity and needs of your project, the default rules may need to be customized and combined, as this recipe will demonstrate.

Getting ready

We are going to continue with the project we created in the Analyzing your C++ code recipe. You will need Visual Studio Professional or higher in order to modify rule sets.

How to do it…

To use a custom rule set, perform the following steps:

  1. Open the project created in the previous recipe.
  2. Open the AnalyzeThis.cpp file and add the following highlighted code:
    # include "AnalyzeThis.h"
    
    int x = 0;
    

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required