首页 计算机源代码编写规范(Code for compiling computer source code)

计算机源代码编写规范(Code for compiling computer source code)

举报
开通vip

计算机源代码编写规范(Code for compiling computer source code)计算机源代码编写规范(Code for compiling computer source code) 计算机源代码编写规范(Code for compiling computer source code) Code for compiling computer source code File number: NW506104 Effective date: 2000.3.20 Controlled number: Security: Secret Revision: Ver2.1 Modif...

计算机源代码编写规范(Code for compiling computer source code)
计算机源代码编写规范(Code for compiling computer source code) 计算机源代码编写规范(Code for compiling computer source code) Code for compiling computer source code File number: NW506104 Effective date: 2000.3.20 Controlled number: Security: Secret Revision: Ver2.1 Modify state: PageCount Six text Six appendix Zero Organized by: Ma Yunsheng Audit: Yuan Huai Ratification: Meng Li Shenyang Dongda ALPINE software Limited by Share Ltd (all rights reserved copy) File change control Modify record number modify state Amend page number and clause Modifier Auditor Approver modification date Catalog 1. purpose 2. scope of application 3. terms and abbreviations 4. specification content 4.1 designation and writing of identifiers 4.2 note rules 4.3 indent rules 1. purpose Good programming style is a very important means to improve the reliability of programs, and is also the technical basis for the cooperation and development of large-scale projects. The purpose of this specification is to avoid bad programming styles by standardizing definitions, and to enhance readability of programs so that they can understand other programmers. 2. scope of application This provision applies to all software source code preparation. When customers have special requirements, they comply with the requirements of customers. For porting development or low release upgrade development, follow the format requirements of the previous version. 3. terms and abbreviations This procedure uses the terms and abbreviations in the NQ402100 quality manual and their definitions. 4. specification content 4.1 identifier naming and writing rules 4.1.1 basic rules 1) here refers to the object identifier syntax in a programming language name, they have constant names, variable names, function names, and the type name, file name, basic syntax identifier is start with a letter, alphanumeric and underlined words. 2) the identifier itself is best able to indicate its own meaning for ease of use and for others to read. Consisting of one or more words in its meaning in application. It can be an English word or a Chinese phonetic word. 3) when the identifier consists of multiple words, the first letter of each word is capitalized, all the others are lowercase, and the constant identifiers are all capitalized. The first phonetic alphabet of each Chinese character described in chinese. English words are not abbreviated as far as possible. If there is an abbreviation, the same expressions must be used in the same system in the same system. 4) the total length of the logo should not exceed 32 characters. 4.1.2 special Convention Some programming tools or project development teams have their own rules for naming identifiers, for example, the identifier is divided into two parts: Standard Identifier prefix + meaning identifier 1) specification identifies the prefix used to indicate the identity of the classification features, and other types of identification to differentiate, for example: the prefix string variable identifier for STR, a string variable named strExample; prefix text box object identifier for the txt, a text box named object: txtExample; 2) the meaning identifier is used to indicate that the identifier corresponds to the abstract entity for memory, In the example above, the "Example" of "strExample" is the meaning identification. Programming tools or project development teams have special agreements, subject to their agreement. 4.1. 3 source code, file identifier, naming rule The source file identifier is divided into two parts, that is, the file name, prefix, and suffix. The format and rules are as follows: * * * * * * * * * * 1) the prefix section is usually associated with the content or function represented by the document. A unified agreement can be made by the project team members. 2) suffix part usually represents the type of the file, you can give yourself, the specific programming environment has special provisions, in accordance with the programming environment. 3) prefixes and suffixes should use only letters, numbers, and underscores in these two parts. The length of the file identifier must not exceed 32 characters for identification. 4.2 notes and formatting requirements Annotations are always added to the needs of a program, a general description, or an ill understood or easily understood error. Annotations should be concise, easy to understand and accurate, and the preferred language is Chinese. If you have input difficulties, compile environment restrictions or special requirements, you can also use english. 4.2.1 source code file comments 1) in the head of the document, you must mark the name of the program and the main functions it has completed. 2) the author of the document and the time it takes to complete it. 3) after the end of the phase test, the main modifications to the activities, people, time, simple reason list. 4) when the procedure needs to be modified during the maintenance process, the modification time and explanation should be indicated in front of the modified statement. The annotation of a function or process of 4.2.2 1) in the function head, the function and parameter (value, parameter, parameter) of the function must be explained; 2) in the main part of a function, such as the algorithm is complex, it should be annotated to explain its algorithm structure; 3) functions that have applied global resources and may cause resource tensions should be annotated (e.g., memory, file handles, etc.); 4) function has side effects, must be marked in a very eye-catching way (such as add, number, etc.) noted; 5) the length of the function is within the 100 statement line (excluding comments), and when the program has special requirements (such as speed requirements, etc.), exceptions can be made. Comments for the 4.2.3 statement 1) add notes to difficult branching conditional expressions; 2) a cycle that is difficult to understand should specify the exit conditions (procedures for GOTO should also specify inlet conditions); 3) too long function realization, should its statement according to the realization of functional segmentation to general description; 4) functions that are invoked by other files or functions, never use global variables to exchange data. 4.2.4 constants and variables are annotated After the declaration of a macro in a constant name (or macro in a language of a macro mechanism), the name should be properly annotated, and the main point of the note is: 1) the meaning of the value to be saved (necessary); 2) the range of legal values (optional); 3) the global quantity needs to be fully explained by the point by point. 4.3 indent rules Indentation of the 4.3.1 control structure The program should display the block structure and control structure of the program in indented form, and reduce the indentation level as much as possible without affecting the display program structure. Use one of the following two indentation methods: 1) 2) If (expression) { 声明 } 其他的 { 声明 } 如果(表达式){ 声明 } 别的{ 声明 } 4.3.2缩进的限制 一个程序的宽度如果超出页宽或屏宽,这将是很难读的,所以本规范要求使用折行缩进的方法、合并表达式或编写子程序的方法来限制程序的宽度。 1)任何一个程序最大行宽不得超过80列,超过者应折行 关于书的成语关于读书的排比句社区图书漂流公约怎么写关于读书的小报汉书pdf 写。 2)建议一个函数的缩进不得超过5级,超过者应将其子块写为子函数; 3)算法或程序本身的特性有特殊要求时,可以超过5级。 计算机源代码编写规范ver2.1 P-2 / 6 沈阳东大阿尔派软件股份有限公司 计算机源代码编写规范ver2.1 P-4 / 6 沈阳东大阿尔派软件股份有限公司
本文档为【计算机源代码编写规范(Code for compiling computer source code)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_079973
暂无简介~
格式:doc
大小:27KB
软件:Word
页数:0
分类:生活休闲
上传时间:2017-10-23
浏览量:10