Cppcheck is an open source cool tool by Daniel Marjamäki used to statically analyse C/C++ code for errors, questionable code, and style. I’ve been tracking it for a number of months and, while it is still in active development, it is already a very useful tool. There are command line and GUI versions available for several platforms.
The Cppcheck wiki page gives a lot more information about it, and lists a couple of hundred checks that are performed on your code.
A git repository is available which makes it easy to keep up-to-date with the latest developments. The source also includes a Qt-based GUI which is quite straightforward to compile using Qt Creator. The GUI is functional, but could use a little bit of work to make it more friendly. In order to view error or warning in the source, for example, Cppcheck requires an external program. It really ought to show you the code in context in the main window, allowing you to correct things within the application.