>
>
Free CppCat for Students

Andrey Karpov
Articles: 673

Free CppCat for Students

CppCat is a static code analyzer integrating into the Visual Studio 2010-2013 environment. The analyzer is designed for regular use, and allows detection of a large number of various error types and typos in programs written in C and C++. For the purpose of popularizing it, we've decided to launch a student-support program granting free licenses to every higher school student who contacts and asks us about it. You just need to send us a photo of your student card or transcript.

Unfortunately, we are no longer developing or supporting the CppCat static code analyzer. Please read here for details.

A few words about static code analysis

Static code analysis tools draw the programmer's attention to fragments which are very likely to contain errors. Here's a simple example:

double var_z;
....
var_z = ( var_z - 16 / 116 ) / 7.787;

This code is correct from the viewpoint of the language and compiler. It's just a regular situation where division of the integer number 16 by integer number 116 results in 0. Expressions like that are necessary sometimes. However, the analyzer takes a wider perspective of the code, and detects an error pattern: if the result of such an integer division is then used together with the double type, it may signal something is wrong.

The analyzer will draw your attention to this suspicious division with the following warning: V636 The '16 / 116' expression was implicitly casted from 'int' type to 'double' type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) / Y;. color.c 125

The code was most likely meant to look as follows:

var_z = ( var_z - 16.0 / 116.0 ) / 7.787;

The division now results in 0,137931 instead of 0.

Static analysis tools can be treated as an extension to compiler warnings. Unlike the compiler, analyzers deal with higher-level constructs, and rely on empirical methods of trying to guess if the code works the way the programmer wanted it to.

A few words about the CppCat analyzer

CppCat is a static code analyzer which is easy to set and use. It is an excellent tool to get started with the static analysis methodology. It is not as powerful as its big brother PVS-Studio (see their comparison), but it is more than sufficient for most tasks. In any case, CppCat's functionality is surely quite enough for students and single developers.

The analyzer can integrate into Visual Studio 2010, 2012, 2013. Unfortunately, it can't integrate into Express editions, and we can't help this, as Visual Studio Express editions don't support plugins.

The analyzer supports the following languages: C, C++, C/CLI, C/CX.

An important feature of the analyzer is automated analysis of freshly modified code. After compilation of the modified files is finished, CppCat starts analyzing the code in the background, and displays a warning whenever anything suspicious is found. This feature allows programmers to detect errors at the very early development stage, and thus save time on bug search and fixes.