P730006L56 SW Process
1
Maturity DO/signature Check/signature(s) Release/signature
Released Process Owner Process Executive
Arno Semmelroth
SV I IS RD SW
Date: 14-Mar-05
e-Sign ListID: 28392
Transmittal, reproduction, dissemination and/or editing of this document as well as utilization of its contents and communication there of to others without express authorization are prohibited.
Process Manager
This document defines C Coding Standard for the development of SW embedded in Automotive
Entertainment Systems and delivered to the customer.
4
Scope (validity area & date, replaced documents):
This Standard is valid for all C code, whether or not produced by subcontractors or development
partners under contract of Siemens VDO. Nevertheless they are not covering all aspects of necessary
or good coding. They need local and/or project specific supplements. These rules add to existing ones
and take precedence in case of differences or contradictions.
5
6 Table of contents
7 1 Process ................................................................................................................................................... 2
8 1.1 Introduction ......................................................................................................................................... 2
9 1.2 C Coding Guidelines ........................................................................................................................... 2
10 2 Metrics ..................................................................................................................................................... 4
11 3 Further explanations .............................................................................................................................. 4
12 3.1.1 International Character Sets ............................................................................................................ 4
13 3.1.2 POSIX .............................................................................................................................................. 4
14 3.1.3 Microprocessor interfaces ................................................................................................................ 4
15 4 Terminology, Definitions and Abbreviations ...................................................................................... 5
16 5 Related documents ................................................................................................................................ 5
17 5.1 Related upstream documents ............................................................................................................. 5
18 5.2 Further related documents .................................................................................................................. 5
19 5.3 Source of figures at this procedure ..................................................................................................... 5
20 6 Teams ...................................................................................................................................................... 6
21 6.1 Procedure Definition Team ................................................................................................................. 6
22 6.2 Review Team ...................................................................................................................................... 6
23 6.3 CCB Team .......................................................................................................................................... 6
24 6.4 Distribution List.................................................................................................................................... 7
25 6.5 History of Changes.............................................................................................................................. 7
26
27
28
P730006L56 SW Process
1 1 Process
2 SV I IS SW Coding Rules & language independent Code Metrics are described in [U-1]. C Specific
3 Coding Guidelines are described here.
4 1.1 Introduction
Transmittal, reproduction, dissemination and/or editing of this document as well as utilization of its contents and communication there of to others without express authorization are prohibited.
5 MISRA has defined "Guidelines for the use of the C language in vehicle based software". HIS has
6 defined a subset of these coding guidelines. This subset can be seen as industry standard for C coding
7 guidelines in automotive industry. For more information see [R-1]
8
9 The following subset of MISRA Coding Guidelines for C is the SV I IS standard for C Coding Guidelines.
P730006L56 SW Process
38 The right-hand operator of a shift operator shall lie between zero and one less than the width
in bits of the left-hand operator (inclusive).
39 The unary minus operator shall not be applied to an unsigned expression.
40 The sizeof-operator should not be used on expressions that contain side effects.
43 Implicit conversions which may result in a loss of information shall not be used.
45 Type casting from any type to and from pointers shall not be used.
Transmittal, reproduction, dissemination and/or editing of this document as well as utilization of its contents and communication there of to others without express authorization are prohibited.
46 The value of an expression shall be the same under any order of evaluation the standard
permits.
48 Mixed precision arithmetic should use explicit casting to generate the desired result.
50 Floating point variables shall not be tested for explicit equality and inequality.
52 There shall be no unreachable code.
56 The goto statement shall not be used.
59 The statement forming the body of an if, else if, else, while, do… while or for statement shall
always be enclosed in braces.
Offenders will be held liable for payment of damages. All rights created by patent grant or registration of a utility model or design patent are reserved.
P730006L56 SW Process
122 The setjmp macro and the longjmp function shall not be used.
123 The signal handling facilities of <signal.h> shall not be used.
124 The input/output library <stdio.h> shall not be used in production code.
125 The library function atof, atoi and toll from library <stdlib.h> shall not be used.
126 The library function abort, exit, getenv and system from library <stdlib.h> shall not be used.
127 The time handling functions from library <time.h> shall not be used.
1
2 2 Metrics
3 Use metrics as defined in the document [R-2].
4 3 Further explanations
5 According to VW, every single violation of a rule has to be documented. The following exceptions apply
6 for SV I IS Code:
9 3.1.2 POSIX
10 Third-party defined operating system interfaces and relating standards (e.g. POSIX) may violate several
11 rules. They may also lead to necessary violations within newly created source code e.g. necessary casts
12 between types declared in the software and types used in the interface.
16
P730006L56 SW Process
15 5 Related documents
16 5.1 Related upstream documents
17 [U-1] F730006LAF SW Coding Procedure, SV I IS
18
19 5.2 Further related documents
20 [R-1] MISRA C Guideline, can be found on Intranet G+O portal
21 [R-2] P730006LAY Measurement Procedure, SV I IS
22
23 5.3 Source of figures at this procedure
24 [F-1] …
25
P730006L56 SW Process
1 6 Teams
2 6.1 Procedure Definition Team
Name Department Location
Transmittal, reproduction, dissemination and/or editing of this document as well as utilization of its contents and communication there of to others without express authorization are prohibited.
P730006L56 SW Process
At project start the latest version of this document has to be used. The latest version is available on
Intranet.
Version Status Date Name, Department Changes
<dd-Mmm-YY> (e.g. CR-number)
a01 Draft 27-Jul-04 Rikowski, SV I IS RD SW Adapted VW Coding Guidelines to
become general guidelines, adapted to
ISQP Template, added scope chapter
a02 Draft 29-July-04 Rikowski, SV I IS RD SW Updates after first review of some
specialists.
a03 Reviewed 19-Aug-04 Rikowski, SV I IS RD SW Update after general review.
Offenders will be held liable for payment of damages. All rights created by patent grant or registration of a utility model or design patent are reserved.