Code check tool for water drop stone wearing C Language

Source: Internet
Author: User
Tags save file

Overview

PC-Lint is a static, with a long history and exceptionally powerful functionsCodeDetection tool. Its history can be traced back to the ancient times of computer programming (more than 30 years ago ). After so many years of development, it not only can monitor many potential operators in the syntax logic, but also can effectively help you propose manyProgramImprovement in space utilization and operational efficiency. In many professional software companies, such as Microsoft and PC-lint, checking for errors without warning is the first level of code, I personally think that PC-Lint is also very important for small companies and individuals to develop, because based on the development cost considerations, small companies and individuals often cannot come up with many comprehensive tests. At this time, the powerful features of PC-Lint can improve the quality of software.

Function

1) PC-Lint isStatic code detection toolIt can be said that PC-Lint is a more rigorous compiler. It can not only check general syntax errors like normal compilers, but also check those that, although fully compliant with syntax requirements, but it is likely to be a potential and hard-to-find error.

2) PC-Lint can not only detect a single file, but alsoDetect problems from the perspective of the entire projectBecauseC LanguageThe individual compilation inherent in the compiler is difficult to detect in the compiler environment. While PC-Lint checks the current file, it also checks all related files, it will be of great help to us.

3) PC-Lint supports almost all popular editing environments and compilers, such as Borland C ++ from 1. X to 5. x versions, Borland C ++ build, GCC, Vc, vc.net, Watcom C/C ++, source insight, Intel C/C ++, etc, it also supports 16/32/64 platform environments.

(4) various methods to improve efficiency and prevent errors described in Scott meyes's popular C ++/more effective C ++.


Overview

This is a good tool that can be used first. Here we will divide it into four steps to ensure that you can use PC-Lint immediately. Of course, if you get started, if you want to learn this tool in depth, you can find the relevant materials on the Internet.ArticleOne of the seven weapons of software development is about the use of PC-lint, which is more detailed than this one. If you are interested, you can also take a look.
Step 1: Install and set

Installation is no different from normal software.

After installing the plug-in, run config.exe in the pc-lintinstallation directory. The configuration is briefly described as follows:

A) Step 1: Provide the installation path of PC-lint and select the save file for the settings.

B) Step 2: select the C/C ++ compiler you are using, for example, Visual C ++ 6.x.

C) Step 3: select the memory mode, for example, 32 bit flat model.

D) In Step 4, select the library used, for example, MFC, Owl, and so on. You can select multiple databases. For Windows development, select windows 32 bit.

E) in step 5, the author of C ++ programming puts forward important suggestions. After selecting an author, the options of his programming suggestions will be opened, such as Scott Meyers.

F) Step 6: Set the header file: You can manually add it in the subsequent steps.

Step 2: integrate PC-lint to the selected compiling environment

After you select the compiler in step 2, you can find an \ "env-selected editing environment in the PC-Lint directory. the LNT \ "file, such as a env-si.lnt for source insight and a env-vc6.lnt for vc6.

Open this file and configure your compiler as described above. The following uses vc6 as an example:

· Select menu tools | customize .....

· Select Tools labels

· Click the dotted box new at the top of the Main Dialog Box

· Input name: PC-Lint

· Input command: C: \ lint \ lint-nt.exe, assuming installation to this path

· Input arguments: C :\\ lint \ STD. LNT? (Filepath )? 7) Select (x) Use Output Window

· Close

· After completion, there will be a PC-Lint option under the Tools menu. The following is the tool configuration diagram:

Step 3: lint a single c file

A) open a c file.

B) Run step 2nd. PC-Lint menu items on step integration

C) the lint result will be displayed within one or two seconds. For the warning explanation, refer to the msg.txt file in the lintinstallation directory, open the file, locate the alarm number, and you will see a detailed description.

Step 4: lint multiple C files

A) Create prjlint under the lint Software Directory. LNT file. The first line of the file is the name of the lint configuration file used. From the second line, list all the lint files you want *. c file name, one line. If you want to output the result to a file, add \ "-OS (File Name) \" (for example: \ "-OS (C: \ lint \ result.txt) to the front) \"). Example: yf_config.lnt

// The following is the. c file for lint,
G: \ SRC \ TT \ tt1.c
G: \ SRC \ TT \ tt2.c
...

B) 2) Add the \ "PC-Lint project \" command in the method described in source insight, all settings are the same as \ "PC-Lint \",

The text in the \ "Run \" edit box in the \ "commandm commands \" dialog box is written by \ "C: \ lint \ lint-nt.exe filename. LNT % F \ "changed to \" C: \ lint \ lint-nt.exe prjlint. lint \ ", that is, change the configuration file name to prjlint. LNT, and remove the \ "% F \"

② The shortcut keys set must be different from PC-lint.

The following doscommand can be used to get a list of *. c files. For example:

① List all *. c files under c: \ SRC and save them to c: \ SRC \ filelist.txt:

Dir c: \ SRC \ *. c/B> C: \ SRC \ filelist.txt

② List all *. c files in the SRC subdirectory under c: \ SRC and add them to the end of c: \ SRC \ filelist.txt:

Dir c: \ SRC \ *. C/S/B> C: \ SRC \ filelist.txt

Important PC-Lint files

Msg.txt: Describes the alert content.

Selected. LNT: path containing the header file,-I option.

Env-selected editing environment. LNT: describes how to combine PC-lint with the corresponding editing environment.

Co-xxx.lnt: The selected compiler.

STD. LNT: Memory Model and other global things.

Lib-xxx.lnt: library type list, including standard C/C ++ library, MFC Library, owl library and so on.

Au-xxx.lnt: the author of C ++ programming who has made important suggestions. After selecting an author, his options for programming recommendations will be turned on.

Options. LNT: Option file that reflects the global compilation information display.

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.