Cppcheck C ++ static code check

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.