7. The spirit of C, Additional Principles for
C1X
ISO/IEC JTC1 SC22WG14 N1250
12. Trust the programmer, as a goal, is outdated in respect to the
security and safetyprogramming communities. While it
should not be totally disregarded as a facet of the spirit of C, the
C1Xversion of the C Standard should take into account that
programmers need the ability to check their work.
13. Unlike for C9X, the consensus at the London meeting was that there
should be no invention, without exception. Only those features that
have a history and are in common use by a commercial
implementation should be considered. Also there must be care to
standardize these features in a way that would make the Standard
and the commercial implementation compatible.
14. Migration of an existing code base is an issue. The ability to mix and
match C89, C99, and C1X based code is a feature that should be
considered for each proposal.
2013/12/14
(c)kaizen@wh.commufa.jp, @kaizen_nagoya
22. 未定義(undefined)と未規定
(unspecified)
3.4.3 undefined behavior: behavior, upon use of a non portable
or erroneous program construct or of erroneous data, for which
this International Standard imposes no requirements
NOTE Possible undefined behavior ranges from ignoring the situation
completely with unpredictable results, to behaving during translation or
program execution in a documented manner characteristic of the
environment (with or without the issuance of a diagnostic message), to
terminating a translation or execution (with the issuance of a diagnostic
message).
EXAMPLE An example of undefined behavior is the behavior on integer
overflow.
3.4.4 unspecified behavior: use of an unspecified value, or
other behavior where this International Standard provides two
or more possibilities and imposes no further requirements on
which is chosen in any Instance
EXAMPLE An example of unspecified behavior is the order in which the
2013/12/14
(c)kaizen@wh.commufa.jp, @kaizen_nagoya
38. MISRA(Motor Industry Softwre Reliability
Association)
MIRA(欧州の自動車関連団体:MotorIndustry Research
Association)
Development guideline for vehicle based software(ISO TR 15497:)
自動車用ソフトウェアの開発ガイドライン(自動車技術会TP01001)
Guidelines for the use of the C language in vehicle based
software(MISRA-C:1998)
自動車用C言語利用のガイドライン(自動車技術会TP-01002)
C90対応
解説書はSESSAME WG3
MISRA-C:2004(C90対応)
2013/12/14
(c)kaizen@wh.commufa.jp, @kaizen_nagoya
60. Rule1.c
*****************************/
* File Name: rule1.c
* Author: kaizen @ wh.commufa.jp
* Date:
2004.09.14
* Version: 0.04
* Purpose: Test Use Only.
* Ruel section
Rule1:すべてのコードは ISO/IEC 9899:1990 を
満たしていなければならず, 拡張機能は許され
ない.
* [MISRAC開発ガイドラインテーブル3]
original Rule 1: All code shall conform to
ISO 9899 standard C,with no extensions
permitted.
**************************/
#define _rule1_c_
#include “../include/misrac.h”
2013/12/14
/******************************
* output section
* Visual Studio 6.0 : no error, no warning
main START
far_ptr_arg = 4198400
pointer = 4198912
near_ptr_arg = 4198912
si32_var = -512
main END
* gcc 3.3.1 (cygwin) : no error, no warning
main START
far_ptr_arg = 4198581
pointer = 4198828
near_ptr_arg = 4198828
si32_var = -247
main END
* End: rule1.c (C) MISRA-C Study Group Japan
* add result 2004.07.14
* add end-result and rule 2004.09.14
*****************************/
(c)kaizen@wh.commufa.jp, @kaizen_nagoya
61. rule5
* rule 5: ISO C標準で使用している文字や拡張表記のみ使
用可能である.
* original rule 5: Only those characters and escape sequences
which are defined in the ISO C standard shall be used.
UI_8 ui8_var4 = '$'; /* NG: $は定義されていない文字 */
UI_8 ui8_var5 = '@'; /* NG: @は定義されていない文字*/
UI_8 ui8_var6 = ‘C’; /* NG: Cは定義されていない拡張表記 */
C標準で使用していない文字を認識。
OSで規定すべきこと->OSごとにStandingDeviationを規定するとよい
。
2013/12/14
(c)kaizen@wh.commufa.jp, @kaizen_nagoya
71. 参考文献
The Motor Industry Software Reliability Association(1994):Development
Guidelines for Vehicle Base Software,ISBN 0952415607
The Motor Industry Software Reliability Association(1998):Guidelines for
THE USE Of The language IN Vehicle Based Software ISBN 0952415690
Guidelines for the use of the C language in critical systems, 2013, ISBN
9781906400-11-8 PDF
JSAE(2002):JASO/TP-01001 自動車用ソフトウェアの開発ガイドライ
ン,社団法人自動車技術会
JSAE(2002):JASO/TP-01002 自動車用C言語利用のガイドライン、社
団法人自動車技術会
B.W.カーニハン,D.M.リッチー著,石田晴久(訳:1989)プログラミング言
語C、共立出版
A.コーニグ著.中村明(訳:2004)Cプログラミングの落とし穴,新紀元
社
アラン・R. フューアー 著, 田中 和明・手塚 忠則 (訳:2000)C
PuzzleBook,カットシステム
2013/12/14
(c)kaizen@wh.commufa.jp, @kaizen_nagoya