没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
This document is the English edition of ESCR (Embedded System development Coding Reference) [C language edition] Version 2.0 published by IPA/SEC* in Japan. It is the revised English edition of ESCR Version 1.1 made available in 2010 in pdf format. Aimed at improving the quality of the source code written in C language, ESCR collects the important points to be noted as part of the know-how for coding and organizes them as practices and rules.
资源推荐
资源详情
资源评论
i
Embedded System development
Coding Reference guide
[C Language Edition]
Ver. 2.0
Written and edited by
Software Reliability Enhancement Center,
Technology Headquarters,
Information-technology Promotion Agency, Japan
ii
This document is the English edition of ESCR (Embedded System development Coding Reference) [C
language edition] Version 2.0 published by IPA/SEC* in Japan. It is the revised English edition of ESCR
Version 1.1 made available in 2010 in pdf format. Aimed at improving the quality of the source code written
in C language, ESCR collects the important points to be noted as part of the know-how for coding and
organizes them as practices and rules.
The purpose of this document is to be used as a reference guide for establishing coding conventions
in organizations and groups developing embedded software using C language, and for promoting the
standardization of coding styles and uniformity of source code quality. The rules in Ver. 1.1 comply with
C90, which was the most widely used C language standard at the time Ver. 1.1 was published. Recently,
more and more C language programmers are using C99 after it was released as the successive version of
C90. To respond to this trend, MISRA C was revised signicantly in March 2013 (and was issued as MISRA
C: 2012). In the process of revising ESCR Ver.1.1 to Ver.2.0, the following two objectives were set to align
with these recent developments in C language standard and MISRA C guidelines:
・
Make the rules compliant with C99, and easy for the programmers to use the new features
supported by C99;
・
Make ESCR consistent with MISRA C to which it is correlated, by reviewing and updating
the references to MISRA C according to its signicant revisions in 2013.
To secure the continuity from the previous version, Ver. 2.0 follows the same structure as Ver. 1.1. The
practices and rules carried over from the previous version are also numbered the same as in Ver. 1.1. To
support the language specications that have been extended in C99, various descriptions have been added to
Ver 2.0, including the introduction of new rules, supplementary explanatory texts, and additional compliant
and non-compliant coding examples. Moreover, in this document, the references to the rules in MISRA
C that have been updated as a part of the signicant revisions made in 2013 are numbered the same as in
MISRA C: 2012, while the references to the rules in MISRA C that now exist only in the previous version
are numbered the same as in MISRA C: 2004.
We sincerely hope that the effective use of ESCR Ver. 2.0 will lead to the improvement of embedded
software productivity and contribute to the attainment of high-quality software development.
July 2014
Software Reliability Enhancement Center, Technology Headquarters,
Information-technology Promotion Agency, Japan
Copyright (c) 2014, IPA/SEC
Permission to copy and distribute this document is hereby granted provided that this notice is retained on all copies, that
copies are not altered, and that IPA/SEC is credited when the material is used to form other copyright policies.
* Software Reliability Enhancement Center, Technology Headquarters, Information-technology Promotion Agency, Japan
iii
Preface
Preface
In recent years, the scale of embedded software has been expanding and development by
many people is becoming mainstream. In such development projects which have large teams
consisting of engineers with various levels of skills, it becomes extremely necessary to take
measures to balance out the differences of their skills. In particular, measures for creating
high quality source code with consideration to safety, maintainability and portability from the
software implementation’s standpoint independently from the engineers' skills are crucially
important, and are regarded as the basic physical strength of embedded software development.
One effective means to address this issue is to prepare and utilize coding conventions where
various coding expertise of the experienced are collected up as knowledge. This background
led us to write and edit the "Coding Practices Guide" targeted for those establishing a coding
convention for C language. In the development of this guide, the drafts were drew up by
experts in programming techniques in the Implementation Quality Technical Committee of
the Embedded Software Development Improvement and Promotion Task Force consists of
members of the METI, IPA/SEC and related organizations.
This book is structured by practices categorized according to quality characteristics and
their corresponding rules. We believe the information provided in this book will help to
establish coding conventions that will meet users’ requirements.
Not only will this book be useful to engineers establishing coding conventions, but it will
also serve as a stimulus for new ways of looking at things with an overview of the C language
characteristics for experienced developers, and for beginners, as a practical textbook which
will be impart the know-how acquired by their predecessors. We hope that use of this book
will lead to improve embedded software productivity and to attain high quality software
development.
March 2006
Embedded Software Development Improvement and Promotion Task Force
Implementation Quality Technical Committee
iv
Table of Contents
Preface iii
Part
1
How to Read theCoding Practices Guide
1
1Overview ...................................................................................................... 2
1.1What are Coding Practices? ............................................................................................ 2
1.2Purpose and Position of Coding Practices and the Target Users .................................... 3
1.3Characteristics of the Coding Practices ........................................................................... 4
1.4Notes on Using this Guide ............................................................................................... 6
2Understanding Source Code Quality ........................................................... 9
2.1Quality Characteristics ..................................................................................................... 9
2.2Quality Characteristics, Coding Practices and Rules .................................................... 14
3How to Use this Guide ............................................................................... 16
3.1Scenarios for Using this Guide ...................................................................................... 16
3.2Creating a New Coding Convention ............................................................................. 17
3.3Enhancing Existing Coding Conventions ....................................................................... 19
3.4Serving as a Learning Material for Programmers' Training and Self-Study ................... 20
Part
2
Coding Practices for Embedded Software: Practices Chart
21
How to Read the Practices Chart 22
Terminology Used in the Practices Chart 26
Coding Practices for Embedded Software 27
Reliability29
Maintainability 67
Portability 127
Efficiency 141
Table of Contents
v
Table of Contents
Part
3
Typical Coding Errors in Embedded Software
145
Typical Coding Errors in Embedded Software ............................................... 146
1Meaningless expressions and statements ....................................................................... 146
2Wrong expressions and statements ................................................................................. 148
3Wrong memory usage ...................................................................................................... 149
4Errors due to misunderstandings in logical operations .................................................... 152
5Mistakes due to typos ...................................................................................................... 153
6Wrong descriptions that do not cause errors in some compilers ..................................... 153
Appendices
155
Appendix A List of practices and rules .......................................................... 157
Appendix B Rule classification based on C language grammar ................... 171
Appendix C Regarding the implementation-defined behaviors ..................... 183
Citations and References .............................................................................................. 191
剩余198页未读,继续阅读
资源评论
lxz467
- 粉丝: 9
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (180014016)pycairo-1.18.2-cp35-cp35m-win32.whl.rar
- (180014046)pycairo-1.21.0-cp311-cp311-win32.whl.rar
- DS-7808-HS-HF / DS-7808-HW-E1
- (180014004)pycairo-1.20.0-cp36-cp36m-win32.whl.rar
- (178330212)基于Springboot+VUE的校园图书管理系统
- (402216)人脸识别
- enspOSPF多区域路由配置
- (175822648)java项目之电信计费系统完整代码.zip
- (175416816)毕业设计基于SpringBoot+Vue的学生综合素质评价系统源码+数据库+项目文档
- (174808034)webgis课程设计文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功