I am trying to give a short answer:
Static analysis examines the syntactic structure of the code and draws conclusions about the behavior of the program. These findings do not always have to be correct.
A typical example of static analysis is data flow analysis, where you compute sets of type used , read , write for each statement. This will help find, for example, uninitialized values.
You can also analyze code related to code patterns. Thus, these tools can be used to verify that you are following a particular coding standard. A typical example of standard coding is MISRA. This coding standard is used for critical security systems and avoids problematic designs in C. Thus, you can already say a lot about the reliability of your applications against memory leaks, dangling pointers, etc.
Dynamic analysis does not only consider syntax, but takes into account state information. In symbolic execution, you add assumptions about the possible values ββof all variables for the operators.
The most expensive and powerful method of dynamic analysis is to test the model, where you really look at all the possible states of the system. You can come up with a model tested by a system as a system that is tested with 100% coverage - but, of course, there are many practical problems that prevent the verification of real systems in this way.
These methods are very effective, and you can learn a lot from static code analysis tools, especially when combined with a good coding standard.
The feature that my development team is really impressive, for example, is that it will tell you in C ++ when a class with virtual methods does not have a virtual destructor. Easy to check actually, but very useful.
Commercial tools are very expensive, but they cost money once you learn how to use them. A typical problem in the beginning is that you will get a lot of false alarms and donβt know where to look for the real problem.
Note that g ++ currently contains some of these materials that are already built-in, and that you can use something like free pclint.
Sorry - this is quite a long time ... I hope this is interesting.