Cppcheck is developed as an open source and easy-to-use application that provides static analysis of C/C++ code.
Cppcheck is an instrument that will check for memory leaks, mismatching allocation-deallocation, buffer overrun, and many more.
The portable version of the software can be found here.
Here are some key features of "Cppcheck":
· Out of bounds checking
· Check the code for each class
· Checking exception safety
· Warn if obsolete functions are used
· Check for invalid usage of STL
· Check for uninitialized variables and unused functions
What's New in This Release: [ read full changelog ]
· New option to enable warnings but not style messages: --enable=warning
· Cppcheck used to skip includes where the header filename is enclosed in . You can now include these headers also by using -I. It is still not required to include these headers so feel free to try it and then include the headers that give you the best results. The biggest problem with including many headers is that analysis gets slow.
· New POSIX checks: pipe() buffer size, redundant calls of set/get user id, too big value passed to usleep(), buffer overflow when using write()
· Storing getc() return value in char variable and comparing to EOF.
· Detect redundant bitand operations
· Find suspicious equality comparisons like: if(a == 0) a == 1;
· Warn about using malloc() for classes containing virtual methods, std::-objects or constructors
· Portability check that warns when using NULL as argument to variadic function. It has undefined behavior on some implementations.