Misra C 2012 Standard & CppCheck

本文介绍了Misra C 2012标准格式,共有143条规则,与CppCheck的说明相吻合。尽管免费版CppCheck不再支持CERT C兼容性检查,但Misra C 2012仍然是C语言开发的重要指导。了解更多详情可参考相关链接。
摘要由CSDN通过智能技术生成

Misra C 2012 Standard format

共143条,与 Cppcheck 的说明一致:
在这里插入图片描述

Appendix A Summary of guidelines
Rule 1.1 Required
Rule Required 1.1 The program shall contain no violations of the standard C syntax and constraints and shall not exceed the implementation's translation limits.
Rule 1.2 Advisory
Rule Advisory 1.2 Language extensions should not be used.
Rule 1.3 Required
Rule Required 1.3 There shall be no occurrence of undefined or critical unspecified behaviour.
Rule 2.1 Required
Rule Required 2.1 A project shall not contain unreachable code.
Rule 2.2 Required
Rule Required 2.2 There shall be no dead code.
Rule 2.3 Advisory
Rule Advisory 2.3 A project should not contain unused type declarations.
Rule 2.4 Advisory
Rule Advisory 2.4 A project should not contain unused tag declarations.
Rule 2.5 Advisory
Rule Advisory 2.5 A project should not contain unused macro declarations.
Rule 2.6 Advisory
Rule Advisory 2.6 A function should not contain unused label declarations.
Rule 2.7 Advisory
Rule Advisory 2.7 There should be no unused parameters in functions.
Rule 3.1 Required
Rule Required 3.1 The character sequences /* and // shall not be used within a comment.
Rule 3.2 Required
Rule Required 3.2 Line-splicing shall not be used in // comments.
Rule 4.1 Required
Rule Required 4.1 Octal and hexadecimal escape sequences shall be terminated.
Rule 4.2 Advisory
Rule Advisory 4.2 Trigraphs should not be used.
Rule 5.1 Required
Rule Required 5.1 External identifiers shall be distinct.
Rule 5.2 Required
Rule Required 5.2 Identifiers declared in the same scope and name space shall be distinct.
Rule 5.3 Required
Rule Required 5.3 An identifier declared in an inner scope shall not hide an identifier declared in an outer scope.
Rule 5.4 Required
Rule Required 5.4 Macro identifiers shall be distinct.
Rule 5.5 Required
Rule Required 5.5 Identifiers shall be distinct from macro names.
Rule 5.6 Required
Rule Required 5.6 A typedef name shall be a unique identifier.
Rule 5.7 Required
Rule Required 5.7 A tag name shall be a unique identifier.
Rule 5.8 Required
Rule Required 5.8 Identifiers that define objects or functions with external linkage shall be unique.
Rule 5.9 Advisory
Rule Advisory 5.9 dentifiers that define objects or functions with internal linkage should be unique.
Rule 6.1 Required
Rule Required 6.1 Bit-fields shall only be declared with an appropriate type.
Rule 6.2 Required
Rule Required 6.2 Single-bit named bit fields shall not be of a signed type.
Rule 7.1 Required
Rule Required 7.1 Octal constants shall not be used.
Rule 7.2 Required
Rule Required 7.2 A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned type.
Rule 7.3 Required
Rule Required 7.3 The lowercase character 'l' shall not be used in a literal suffix.
Rule 7.4 Required
Rule Required 7.4 A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char".
Rule 8.1 Required
Rule Required 8.1 Types shall be explicitly specified.
Rule 8.2 Required
Rule Required 8.2 Function types shall be in prototype form with named parameters.
Rule 8.3 Required
Rule Required 8.3 All declarations of an object or function shall use the same names and type qualifiers.
Rule 8.4 Required
Rule Required 8.4 A compatible declaration
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值