Harman Patil (Editor)

Cppcheck

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Original author(s)
  
Daniel Marjamäki

Written in
  
C++

Development status
  
Active

Initial release
  
May 8, 2007; 9 years ago (2007-05-08)

Stable release
  
1.77 / December 31, 2016; 2 months ago (2016-12-31)

Repository
  
github.com/danmar/cppcheck.git

Cppcheck is a static code analysis tool for the C and C++ programming languages. It is a versatile tool that can check non-standard code. The creator and lead developer is Daniel Marjamäki.

Contents

Cppcheck is free software under the GNU General Public License.

Features

Cppcheck supports a wide variety of static checks that may not be covered by the compiler itself. These checks are static analysis checks that can be performed at a source code level. The program is directed towards static analysis checks that are rigorous, rather than heuristic in nature.

Some of the checks that are supported include:

  • Automatic variable checking
  • Bounds checking for array overruns
  • Classes checking (e.g. unused functions, variable initialization and memory duplication)
  • Usage of deprecated or superseded functions according to Open Group
  • Exception safety checking, for example usage of memory allocation and destructor checks
  • Memory leaks, e.g. due to lost scope without deallocation
  • Resource leaks, e.g. due to forgetting to close a file handler
  • Invalid usage of Standard Template Library functions and idioms
  • Miscellaneous stylistic and performance errors
  • As with many analysis programs, there are many unusual cases of programming idioms which may be acceptable in particular target cases, or outside of the programmer's scope for source code correction. A study conducted in March 2009 identified several areas where false positives were found by cppcheck, but did not specify the program version examined. Cppcheck has been identified for use in systems such as CERNs 4DSOFT meta analysis package, for code verification in high energy particle detector readout devices, system monitoring software for radio telescopes as well as in error analysis of large projects, such as OpenOffice.org and the Debian archive.

    Development

    The project is actively under development and is actively maintained in different distributions. It has found valid bugs in a number of popular projects such as the Linux kernel and MPlayer.

    Plugins

    Plugins for the following IDEs exist

  • CLion
  • Code::Blocks - integrated.
  • CodeLite - integrated.
  • Eclipse
  • Emacs
  • gedit
  • Hudson
  • Jenkins
  • Sublime Text
  • Yasca
  • KDevelop
  • Kate
  • Visual Studio integration

    The commercial third-party Add-In Visual Lint by British company Riverblade can be used to integrate CppCheck in Visual Studio. There is also an open source plugin cppcheck-vs-addin available. It is also possible to add Cppcheck as an external tool.

    References

    Cppcheck Wikipedia