cppcheck/gui/help/ch02s04.html

10 lines
2.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Stylistic issues</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s03.html" title="Excluding a file or folder from checking"><link rel="next" href="ch02s05.html" title="Saving results in file"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Stylistic issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr></table><hr></div><div class="section" title="Stylistic issues"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2634936"></a>Stylistic issues</h2></div></div></div><p>By default Cppcheck will only check for bugs. There are also a few
checks for stylistic issues.</p><p>Here is a simple code example:</p><pre class="programlisting">void f(int x)
{
int i;
if (x == 0)
{
i = 0;
}
}</pre><p>To enable stylistic checks, use the --style flag:</p><pre class="programlisting">cppcheck --enable=style file1.c</pre><p>The reported error is:</p><pre class="programlisting">[file3.c:3]: (style) The scope of the variable i can be limited</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Excluding a file or folder from checking </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Saving results in file</td></tr></table></div></body></html>