Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools it does not detect syntax errors in the code. Cppcheck primarily detects the types of bugs that the compilers normally do not detect. The goal is to detect only real errors in the code (i.e. have zero false positives).
You can download the standalone Cppcheck from our project page or add it as a plugin for your favorite IDE:
- Code::Blocks - integrated
- CodeLite - integrated
- Eclipse - Cppcheclipse
- gedit - gedit plugin
- Hudson - Cppcheck Plugin
- Jenkins - Cppcheck Plugin
- Tortoise SVN - Adding a pre-commit hook script
- Mercurial (Linux) - pre-commit hook - Check for new errors on commit (requires interactive terminal)
There is no plugin for Visual Studio, but it is possible to add Cppcheck as an external tool. You can also try the proprietary PVS-Studio (there is a free trial), which is oriented for this environment. A comparison of Cppcheck and PVS-Studio can be found here and we believe it's a good and honest comparison.
- Out of bounds checking
- Check the code for each class
- Checking exception safety
- Memory leaks checking
- Warn if obsolete functions are used
- Check for invalid usage of STL
- Check for uninitialized variables and unused functions
- Use Trac to report bugs and feature requests
- Ask questions in the discussion forum or at the IRC channel #cppcheck
- For more details look at the wiki
You are welcome to contribute. Help is needed.
- Pick a project and test it's source with latest version. Write tickets to Trac about issues you find from Cppcheck. If you test open source projects and write bug reports to them, check the issues in the “Found bugs” wiki section, and write links to the bug reports you have created e.g. to our forum, so we can keep a track about them.
- Pick a ticket from Trac, write a test case for it (and write a comment to the ticket that test case has been created). Or pick a test case that fails and try to fix it. Make a patch and submit it to Trac either inline if it is small, or attach it as a file.
- Write articles, reviews or tell your friends about us. The more users we have, the more people we have testing and the better we can become.
- Invent new good checks and create tickets to Trac about them.
- Write a plugin to your favorite IDE or create a package for your distribution or operating system.
- Technical Writer
- Write better documentation for the bugs we find. Currently only a few bugs have any documentation at all.