Appendex A Summary of guidelines
Rule 1.1 Required
All code shall conform to ISO/IEC 9899:1990 Programming languages C, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2:1996
Rule 1.2 Required
No reliance shall be placed on undefined or unspecified behaviour.
Rule 1.3 Required
Multiple compilers and/or languages shall only be used if there is a common defined interface standard for object code to which the languages/compilers/assemblers conform.
Rule 1.4 Required
The compiler/linker shall be checked to ensure that 31 character significance and case sensitivity are supported for external identifiers.
Rule 1.5 Advisory
Floating-point implementations should comply with a defined floating-point standard. Language extensions
Rule 2.1 Required
Assembly language shall be encapsulated and isolated.
Rule 2.2 Required
Source code shall only use /*
*/ style comments.
Rule 2.3 Required
The character sequence /* shall not be used within a comment.
Rule 2.4 Advisory
Sections of code should not be commented out. Documentation
Rule 3.1 Required
All usage of implementation-defined behaviour shall be documented.
Rule 3.2 Required
The character set and the corresponding encoding shall be documented.
Rule 3.3 Advisory
The implementation of integer division in the chosen compiler should be determined, documented and taken into account.
Rule 3.4 Required
All uses of the #pragma directive shall be documented and explained.
Rule 3.5 Required
The implementation defined behaviour and packing of bitfields shall be documented if being relied upon.
Rule 3.6 Required
All libraries used in production code shall be written to comply with the provisions of this document, and shall have been subject to appropriate validation. Character sets
Rule 4.1 Required
Only those escape sequences that are defined in the ISO C standard shall be used.
Rule 4.2 Required
Trigraphs shall not be used.
Identifiers
Rule 5.1 Required
Identifiers (internal and external) shall not rely on the significance of more than 31 characters.
Rule 5.2 Required
Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier.
Rule 5.3 Required
A typedef name shall be a unique identifier.
Rule 5.4 Required
A tag name shall be a unique identifier.
Rule 5.5 Advisory
No object or function identifier with static storage duration should be reused.
Rule 5.6 Advisory
No identifier in one name space should have the same spelling as an identifier inanother name space, with the exception of structure member and union member names.
Rule 5.7 Advisory
No identifier name should be reused.
Types
Rule 6.1 Required
The plain char type shall be used only for storage and use of character values.
Rule 6.2 Required
signed and unsigned char type shall be used only for the storage and use of numeric values.
Rule 6.3 Advisory
typedefs that indicate size and signedness should be used in place of the basic numerical types.
Rule 6.4 Required
Bit fields shall only be defined to be of type unsigned int or signed int.
Rule 6.5 Required
Bit fields of signed type shall be at least 2 bits long.
Constants
Rule 7.1 Required
Octal constants (other than zero) and octal escape sequences shall not be used. Declarations and definitions
Rule 8.1 Required
Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call.
Rule 8.2 Required
Whenever an object or function is declared or defined, its type shall be explicitly stated.
Rule 8.3 Required
For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical.
Rule 8.4 Required
If objects or functions are declared more than once their types shall be compatible.
Rule 8.5 Required
There shall be no definitions of objects or functions in a header file.
Rule 8.6 Required
Functions shall be declared at file scope.
Rule 8.7 Required
Objects shall be defined at block scope if they are only accessed from within a single function.
Rule 8.8 Required
An external object or function shall be declared in one and only one file.
Rule 8.9 Required
An identifier with external linkage shall have exactly one external definition.
Rule 8.10 Required
All declarations and definitions of objects or functions at file scope shall have internal linkage unless external linkage is required.
Rule 8.11 Required
The static storage class specifier shall be used in definitions and declarations of objects and functions that have internal linkage.
Rule 8.12 Required
When an array is declared with external linkage, its size shall be stated explicitly or defined implicitly by initialisation.
Initialisation
Rule 9.1 Required
All automatic variables shall have been assigned a value before being used.
Rule 9.2 Required
Braces shall be used to indicate and match the structure in the non-zero initialisation of arrays and structures.
Rule 9.3 Required
In an enumerator list, the = construct shall not be used to explicitly initialise members other than the first, unless all items are explicitly initialised.
Arithmetic type conversions
Rule 10.1 Required
The value of an expression of integer type shall not be implicitly converted to a different underlying type if:
(a) it is not a conversion to a wider integer type of the same signedness, or
(b) the expression is complex, or
(c) the expression is not constant and is a function argument, or
(d) the expression is not constant and is a return expression
Rule 10.2 Required
The value of an expression of floating type shall not be implicitly converted to a different type if:
(a) it is not a conversion to a wider floating type, or
(b) the expression is complex, or
(c) the expression is a function argument, or
(d) the expression is a return expression
Rule 10.3 Required
The value of a complex expression of integer type shall only be cast to a type of the same signedness that is no wider than the underlying type of the expression.
Rule 10.4 Required
The value of a complex expression of floating type shall only be cast to a floating type that is narrower or of the same size.
Rule 10.5 Required
If the bitwise operators ~ and << are applied to an operand of underlying type unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand.
Rule 10.6 Required
A U suffix shall be applied to all constants of unsigned type.
Pointer type conversions
Rule 11.1 Required
Conversions shall not be performed between a pointer to a function and any type other than an integral type.
Rule 11.2 Required
Conversions shall not be performed between a pointer to object and any type other than an integral type, another pointer to object type or a pointer to void.
Rule 11.3 Advisory
A cast should not be performed between a pointer type and an integral type.
Rule 11.4 Advisory
A cast should not be performed between a pointer to object type and a different pointer to object type.
Rule 11.5 Required
A cast shall not be performed that removes any const or volatile qualification from the type addressed by a pointer.
Expressions
Rule 12.1 Advisory
Limited dependence should be placed on Cs operator precedence rules in expressions.
Rule 12.2 Required
The value of an expression shall be the same under any order of evaluation that the standard permits.
Rule 12.3 Required
The sizeof operator shall not be used on expressions that contain side effects.
Rule 12.4 Required
The right-hand operand of a logical && or || operator shall not contain side effects.
Rule 12.5 Required
The operands of a logical && or || shall be primary-expressions.
Rule 12.6 Advisory
The operands of logical operators (&&, || and !) should
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 3 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- 维民所止12262024-01-10大佬,真良心
- 大花狸2023-10-25大佬,真良心
- talos512023-05-06nice work
![avatar](https://profile-avatar.csdnimg.cn/c004bc6b96b048dda1233e043807050c_rain0sky.jpg!1)
一念而行
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)