Static code analysis can find bugs and catch other gotchas within code-bases, including some issues that might not be easily detected by the programmer. Clang supports static analysis within C, Objective-C, and C++ code-bases. For those new programmers or just not familiar with Clang's abilities, you can learn more about the Clang static analyzer via the LLVM sub-project web-site.
Should you be new to Clang and want to check it out, KDE developer Ivan Čukić has written a brief yet effective blog post going over the Clang static analyzer. For test purposes he analyzed the KActivities code-base. Read Ivan's blog post for some of the basics of using the Clang static analyzer.