C Language Programming Specification--------10 code editing, compiling, review

Source: Internet
Author: User

(1) Turn on all the alarm switches of the compiler to compile the program.

(2) in the Product Software (project group), to unify the compilation switch option.

(3) Check the code through the Code of the daytime and the way of review. The code is mainly to the programming style of the program, such as annotations, naming, and programming error-prone content to check, can be done by the developer or the developer cross-way; code review is the implementation of the program's functions and procedures for the stability, security, reliability, etc. to check and review, through self-audit, Cross-audit or designated department spot checks, and other methods.

(4) test the product before testing, the code should be checked and reviewed.

(5) Write code should be careful to save at any time, and regular backup, to prevent due to power outages, hard disk damage and other causes of code loss.

(6) with the Product Software (project group), it is best to use the same editor and use the same setup options. The same project team is best to use the same smart language editor, such as Elipse, and design, use a set of indentation macros and annotation macros, and so on, the indentation and other issues to the editor processing.

(7) Be careful to program using the block copy function provided by the editor. When a piece of code is similar to another piece of code, many developers use the block copy feature provided by the editor to complete the code. Because the program function is similar, so the variable used, the expression used in the function and the name may be very similar, so use the block copy should pay attention to, in addition to modify the corresponding program, must be used to carefully review each variable to change to correct. The compiler should not be expected to detect all such errors, such as when using global variables, it is possible to make some kind of error hidden.

(8) Reasonable design of the software system catalog, easy to use by developers. Convenient and reasonable catalog of software system can improve work efficiency. The principle of directory construction is to facilitate the storage of the source program, query, compile, link and so on, while the directory should also have a working directory----all the compilation, linking and other work should be done in this directory, tools directory----about file editor, file lookup and other tools can be stored in this directory.

(9) Some statements are compiled to generate alarms, but if you think it is correct, you should remove the alarm information by some means. For example, in Borland/C + +, you can use "#pragma warn" to turn off or turn off some alarms.

Example:

#pragma WARN-RVL//off alarm

int Examples_fun (void)

{

program, but no return statement.

}

#pragma warn +RVL//Open Alarm

The compile function Examples_fun should have generated a "function should return value" alarm, but because the alarm information is turned off display, so compile will not produce this alarm prompt.

Check the source program using code-checking tools such as C-Pc-lint, and use software tools such as Logiscope for code review.

C Language Programming Specification--------10 code editing, compiling, review

Related Article

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.