Stylistic issues

By default Cppcheck will only check for bugs. There are also a few checks for stylistic issues.

Here is a simple code example:

void f(int x)
{
    int i;
    if (x == 0)
    {
        i = 0;
    }
}

To enable stylistic checks, use the --style flag:

cppcheck --enable=style file1.c

The reported error is:

[file3.c:3]: (style) The scope of the variable i can be limited