From: http://blog.csdn.net/fuyangchang/article/details/6727109
1. cppcheck Introduction
Cppcheck is a static code check tool that supports C and C ++ code. cppcheck performs strict logical checks on the source code of the product as a supplementary check of the compiler. The following checks are performed:
1. Automatic Variable check
2. array boundary check
3. Class check
4. Expired functions, discard function call check
5. Abnormal memory usage, release check
6. Memory leakage check, mainly through memory reference pointer
7. operating system resource release check, interruption, file descriptor, etc.
8. Abnormal STL function usage check
9. Code Format error and Performance Factor check
Here is the introduction of cppcheck: http://sourceforge.net/apps/mediawiki/cppcheck/index.php? Title = main_page
Ii. Install cppcheck
Cppcheck in Linux is as follows.
Decompress file: Tar xvf cppcheck-1.49.tar.gz
Compile file: CD cppcheck-1.49 & make
Iii. Use cppcheck
Run cppcheck-h to get the parameter prompt. Here we will introduce the parameters I used.
Cppcheck-J 3 -- enable = all search /*
-The J parameter specifies the number of check threads. If you need to check a large amount of code, the-J parameter is still very useful.
-- Enable specifies the current check level. Optional parameters include all, style, and information.
Iv. Summary
Cppcheck is very simple to use and can easily check for obvious errors in the Code. This can be used frequently. Good code!