Which tool for code analysis is the best for complex C programs?

I use GCC debugger with Code Blocks 13.12

Thanks for replies.

There is no one best.

First, turn on lots of extra warnings/errors in GCC, and fix them all. -Wall,-Wextra, -pedantic-errors, and so on. Have a look through the list
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Then, get the Clang/LLVM C compiler, and rebuild your code with that, similarly with lots of errors and warnings turned on. Fix them all.

Never turn off all these warnings and errors.

Then, run the clang static analyzer on your code http://clang-analyzer.llvm.org/

Then, if you're not using OS specific libraries, repeat all the above steps on a different operating system.

These are all easy and free ways to significantly improve your code, and they will catch a large percentage of the worst problems. Beyond this, the field expands, and once you have taken these easy, free steps, then look further.

You should also do at least some dynamic analysis of your code. Run it under valgrind on Linux. This will flag up significant memory errors you might be making.

Edited 1 Year Ago by Moschops

This question has already been answered. Start a new discussion instead.