Hvac Programming Guide
Hvac Programming Guide
                                                                                                                                                                                                                                                                File:
                                                                                                  damages. All rights created by patent grant or registration of a utility
                                                                                                                                                    plan.
                                                                                                  model or design patent are reserved.
                                                                                    Released by
                                                                                                             Designed by
                                                                                                                                                                                                                                                       Notes:
                                                                                                                                                                                                                                                                                Status:
                                                                                                                                                                                                                                                                                                         Author:
Revision:
Designation
                                             Documentkey
                                                                                                                                                                                                                                                                                                                                                  HVAC Programming Guideline
                                                                                                                                                                                                                                                                                             1.1
                                                                                                                                                                                                                                                                                <released>
                                                                                                                                                                                                                                                                                                         Limoa, HVAC
                                                                                                                                                                                                                                                                                                                       HVAC MISRA Rules
466230176.doc
                                                                                                                             Date
                                                                                                  2003-03-12
                                                                                                                             Department
                                                                                                                                                                                                                                                                                                                       HVAC C-Programming Rules
SV I IP HVAC TA SW
                                  1 of 181
                                                                                                                                                    a project-specific agreement has been reached, written, reviewed and released in the project
                                                                                                                                                    The SMK is valid in all matters and specifications that are not described here in detail, unless
A4 : 2003-02
                                                                                                  This document and the information ..............................................
                                                                                                  Document, in so far as it is based on VDO authorship, are and remain
                                                                                                  the property of VDO. This document and ll information is confidential.
                                                                                                  The user is not allowed to disclose it to third parties without having the
                                                                                                  prior written consent of VDO. All rigths, especially with regard to
                                                                                                  inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                  dissemination and/or editing of this document as well as utilization of its
                                                                                                                                                                                                                                                               1
                                                                                                  contents and communication there of to others without express
                                                                                                  authorization are prohibited. Offenders will be held liable for payment of
                                                                                                                                                                                     1.0
                                                                                                                                                                                           1.0
                                                                                                                                                                                                 1.0
                                                                                                                                                                                                       1.0
                                                                                                                                                                                                             1.1
                                                                                                                                                                                                                               1.0
                                                                                                  damages. All rights created by patent grant or registration of a utility
                                                                                                  model or design patent are reserved.
                                                                                    Released by
                                                                                                             Designed by
                                                                                                                                                                                                                                              Revision
Date
                                                                                                                                                                                                             2005.09.21
                                                                                                                                                                                                                               2003.12.03
Sofian.limoa@siemens.com
Designation
                                             Documentkey
                                                                                                                                                                                                                                                                         HVAC Programming Guideline
                                                                                                                                                                                                                                              Author, Editor
                                                                                                                                                                                                                               Sofian Limoa
                                                                                                                                                                                                             Leichner, Frank
                                                                                                                             Date
                                                                                                  2003-03-12
                                                                                                                             Department
                                                                                                                                                                                                                               initial
                                                                                                                                                                                                                                              Reason
Freigabe
SV I IP HVAC TA SW
                                  2 of 181
A4 : 2003-02
                                             HVAC Programming Guideline
2 Table of Contents
1 History..............................................................................................................................2
2 Table of Contents............................................................................................................3
                                                                                   3700 – 3713, 3715, 3717, 3719, 3720 – 3723, 3725, 3727, 3729, 3730 – 3736, 3738,
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                                                                   3740 – 3748, 3750, 3752 – 3760, 3762 – 3772, 3774- 3807, 3810 – 3819, 3821 - 3834,
contents and communication there of to others without express
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                   3837, 3839, 3840, 3843, 3844, 3847, 3848, 3850 - 3881, 3892, 3900 – 3913, 3915,
                                                                                   3917, 3919 - 3923, 3925, 3927, 3929 - 3936, 3938, 3940 – 3948, 3950, 3952 - 3960,
                                                                                   3962 – 3972, 3974 – 4007, 4010 - 4019, 4021- 4034, 4037, 4039, 4040, 4043, 4044,
                                                                                   4047, 4048, 4050 - 4081.................................................................................................21
model or design patent are reserved.
                                                                                                                                                Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                     2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                            Designation                                                                                         Status
                                                                                                                                                                                                                released
                                                                                                            Documentkey                                                                                         Pages
                                                                                                                                                                                                                3 of 181
                                                   Siemens VDO Automotive AG                                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                        3.2.4                            Identifiers................................................................................................................92
contents and communication there of to others without express
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                   MISRA Rule 11: Identifiers (internal and external) shall not rely on significance of
                                                                                   more than 31 characters. Furthermore the compiler/linker shall be checked to
                                                                                   ensure that 31 character significance and case sensitivity are supported for
                                                                                   external identifiers........................................................................................................92
model or design patent are reserved.
                                                                                                                                               Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                    2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                            Designation                                                                                       Status
                                                                                                                                                                                                              released
                                                                                                            Documentkey                                                                                       Pages
                                                                                                                                                                                                              4 of 181
                                                   Siemens VDO Automotive AG                                                                                                Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   MISRA Rule 14: The type char shall always be declared as unsigned char or
                                                                                   signed char....................................................................................................................93
                                                                                   QAC-Rule 3625..............................................................................................................94
                                                        3.2.6                             Constants................................................................................................................94
                                                                                   MISRA Rule 19: Octal constants (other than zero) shall not be used.....................94
                                                                                   QAC Rules: 0339, 3628.................................................................................................94
                                                        3.2.7                             Declaration and Definition, Misra-Rules: 20, 21, 24, 25, 26, 29*........................94
                                                                                   MISRA Rule 20: All object and function identifiers shall be declared before use. 95
                                                                                   QAC-Rule 3335..............................................................................................................95
                                                                                   MISRA Rule 21: Identifiers in an inner scope shall not use the same name as an
                                                                                   identifier in an outer scope, and therefore hide that identifier................................95
                                                                                   QAC-Rules: 2547, 3334.................................................................................................96
                                                                                   MISRA Rule 24: Identifiers shall not simultaneously have both internal and
                                                                                   external linkage in the same translation unit.............................................................97
                                                                                   QAC-Rule 0625..............................................................................................................98
                                                                                   MISRA Rule 25: An identifier with external linkage shall have exactly one external
                                                                                   definition........................................................................................................................98
                                                                                   QAC-Rules 0630, 5025..................................................................................................98
                                                                                   MISRA Rule 26: If objects or functions are declared more than once they shall
                                                                                   have compatible declarations......................................................................................98
                                                                                   QAC-Rules: 0626, 0627, 0628, 5026.............................................................................99
                                                                                   MISRA Rule 29: The use of a tag shall agree with its declaration.........................100
                                                                                   QAC-Rule: 0547...........................................................................................................101
                                                        3.2.8                             Initialization..........................................................................................................101
                                                                                   MISRA Rule 32: In an enumerator list, the '=' construct shall not be used to
                                                                                   explicitly initialise members other than the first, unless all items are explicitly
                                                                                   initialised......................................................................................................................101
dissemination and/or editing of this document as well as utilization of its
                                                                                   QAC-Rule 0723............................................................................................................102
This document and the information ..............................................
                                                        3.2.9                             Operators, Misra Rules: 33*, 34, 35, 36, 37*, 42................................................102
                                                                                   MISRA Rule 33*: The right hand operand of a && or || operator shall not contain
                                                                                   side effects..................................................................................................................102
                                                                                   QAC-Rule 3415............................................................................................................103
model or design patent are reserved.
                                                                                   MISRA Rule 34: The operands of a logical && or || shall be primary expressions.
                                                                                   ......................................................................................................................................103
                                                                                                                                                  Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                       2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                             Designation                                                                                          Status
                                                                                                                                                                                                                  released
                                                                                                             Documentkey                                                                                          Pages
                                                                                                                                                                                                                  5 of 181
                                                   Siemens VDO Automotive AG                                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   QAC-Rule 3400............................................................................................................103
                                                                                   MISRA Rule 35: Assignment operators shall not be used in expressions which
                                                                                   return Boolean values................................................................................................104
                                                                                   QAC-Rule 3326............................................................................................................104
                                                                                   MISRA Rule 36: Logical operators should not be confused with bitwise operators.
                                                                                   ......................................................................................................................................104
                                                                                   QAC Rules: 4101, 4102, 4106– 4110..........................................................................105
                                                                                   MISRA Rule 37: Bitwise operations shall not be performed on signed integer
                                                                                   types.............................................................................................................................106
                                                                                   QAC-Rules 0502, 4130, 4131......................................................................................106
                                                                                   MISRA Rule 42: The comma operator shall not be used, except in the control
                                                                                   expression of a for loop.............................................................................................107
                                                                                   QAC-Rules 3417..........................................................................................................108
                                                        3.2.10                            Conversions.........................................................................................................108
                                                                                   MISRA Rule 45: Type casting from any type to or from pointers shall not be used.
                                                                                   ......................................................................................................................................108
                                                                                   QAC-Rules: 0306, 0307, 0308, 0310, 0311, 0312, 3305............................................109
                                                        3.2.11                            Expressions, Misra-Rules 46, 49, 50..................................................................111
                                                                                   MISRA Rule 46: The value of any expression shall be independent of the order of
                                                                                   its evaluation...............................................................................................................111
                                                                                   QAC-Rules: 0400, 0401, 0402, 0403...........................................................................112
                                                                                   MISRA Rule 49: Tests of a value against zero should be made explicit, unless the
                                                                                   operand is effectively Boolean..................................................................................113
                                                                                   QAC-Rule 3344............................................................................................................114
                                                                                   MISRA Rule 50: Floating point variables shall not be tested for exact equality or
                                                                                   inequality.....................................................................................................................114
                                                                                   QAC-Rule 3341............................................................................................................115
dissemination and/or editing of this document as well as utilization of its
                                                        3.2.12                            Control Flow, Misra-Rules 53*, 56, 57, 58, 59, 61, 62, 64, 65...........................115
This document and the information ..............................................
                                                                                                                                                  Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                       2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                             Designation                                                                                          Status
                                                                                                                                                                                                                  released
                                                                                                             Documentkey                                                                                          Pages
                                                                                                                                                                                                                  6 of 181
                                                   Siemens VDO Automotive AG                                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   MISRA Rule 58: The break statement shall not be used (except to terminate the
                                                                                   cases of a switch statement).....................................................................................118
                                                                                   QAC-Rules: 0769, 3333...............................................................................................119
                                                                                   MISRA Rule 59: The statements forming the body of an if, else if, else, while,
                                                                                   do ... while or for statement shall always be enclosed in braces..........................119
                                                                                   QAC-Rules: 2212, 2214, 3402.....................................................................................120
                                                                                   MISRA Rule 61: Every non-empty case clause in a switch statement shall be
                                                                                   terminated with a break statement............................................................................121
                                                                                   QAC-Rule 2003............................................................................................................122
                                                                                   MISRA Rule 62: All switch statements should contain a final default clause......123
                                                                                   QAC-Rules: 2002, 2009...............................................................................................123
                                                                                   MISRA Rule 64: Every switch statement shall have at least one case.................123
                                                                                   QAC-Rule 3315............................................................................................................124
                                                                                   MISRA Rule 65: Floating point variables shall not be used as loop counters.....124
                                                                                   QAC-Rule 3340............................................................................................................124
                                                        3.2.13                            Functions, Misra-Rules: 68, 69, 70*, 72, 73, 75, 76, 78, 79, 80, 82, 83, 84.......124
                                                                                   MISRA Rule 68: Functions shall always be declared at file scope........................124
                                                                                   QAC-Rule 3221............................................................................................................125
                                                                                   MISRA Rule 69: Functions with variable numbers of arguments shall not be used.
                                                                                   ......................................................................................................................................125
                                                                                   QAC-Rule 5069............................................................................................................125
                                                                                   MISRA Rule 70*: Functions shall not call themselves, either directly or indirectly:
                                                                                   ......................................................................................................................................125
                                                                                   QAC-Rules: 3670, 5070...............................................................................................126
                                                                                   MISRA Rule 72: For each function parameter the type given in the declaration and
                                                                                   definition shall be identical, and the return types shall also be identical............126
dissemination and/or editing of this document as well as utilization of its
                                                                                   MISRA Rule 73: Identifiers shall either be given for all of the parameters in a
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                   QAC-Rule 2050............................................................................................................129
                                                                                   MISRA Rule 76: Functions with no parameters shall be declared with parameter
                                                                                   type void......................................................................................................................129
                                                                                                                                                  Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                       2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                             Designation                                                                                          Status
                                                                                                                                                                                                                  released
                                                                                                             Documentkey                                                                                          Pages
                                                                                                                                                                                                                  7 of 181
                                                   Siemens VDO Automotive AG                                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   QAC-Rule 1303............................................................................................................129
                                                                                   MISRA Rule 78: The number of parameters passed to a function shall match the
                                                                                   function prototype......................................................................................................129
                                                                                   QAC-Rules: 0422, 0423, 3319.....................................................................................130
                                                                                   MISRA Rule 79: The values returned by void functions shall not be used..........130
                                                                                   QAC 0543.....................................................................................................................131
                                                                                   MISRA Rule 80: Void expressions shall not be passed as function parameters.131
                                                                                   QAC 0541.....................................................................................................................131
                                                                                   MISRA Rule 82: A function should have a single point of exit..............................132
                                                                                   QAC-Rule 2006............................................................................................................132
                                                                                   MISRA Rule 83: Functions with non-void return type shall have: i) one return
                                                                                   statement for every exit branch (including the end of the program), ii) each return
                                                                                   shall have an expression, iii) the expression shall match the return type...........132
                                                                                   QAC-Rules: 0744, 0745, 1403, 1413, 1423, 1433, 1443, 3900 – 3913, 3915, 3917,
                                                                                   3919 - 3923, 3925, 3927, 3929 – 3936, 3938, 3940 – 3948, 3950, 3952 – 3960, 3962 –
                                                                                   3972, 3974 – 4007, 4010 – 4019, 4021 – 4034, 4037, 4039, 4040, 4043, 4047, 4048,
                                                                                   4050 – 4081..................................................................................................................133
                                                                                   MISRA Rule 84: For functions with void return type, return statements shall not
                                                                                   have an expression.....................................................................................................162
                                                                                   QAC-Rule 0746............................................................................................................162
                                                        3.2.14                           Preprocessing Directives, Misra-Rules: 88, 89, 91, 94, 95, 96, 98, 99, 100....163
                                                                                   MISRA Rule 88: Non-standard characters shall not occur in header file names in
                                                                                   #include directives......................................................................................................163
                                                                                   QAC-Rules 0813, 0814, 0831......................................................................................163
                                                                                   MISRA Rule 89: The #include directive shall be followed by either a <filename> or
                                                                                   "filename" sequence..................................................................................................163
                                                                                   QAC-Rules: 0809, 0832...............................................................................................164
dissemination and/or editing of this document as well as utilization of its
                                                                                   MISRA Rule 91: Macros shall not be #define'd and #undef'd within a block.......164
the property of VDO. This document and ll information is confidential.
                                                                                   QAC-Rule 0842............................................................................................................164
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                   MISRA Rule 94: A function-like macro shall not be 'called' without all of its
                                                                                   arguments....................................................................................................................165
                                                                                   QAC-Rules: 0850, 0856...............................................................................................165
model or design patent are reserved.
                                                                                   MISRA Rule 95: Arguments to a function-like macro shall not contain tokens that
                                                                                   look like pre-processing directives...........................................................................165
                                                                                   QAC-Rule 0853............................................................................................................166
                                                                                                                                              Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                   2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                           Designation                                                                                      Status
                                                                                                                                                                                                            released
                                                                                                           Documentkey                                                                                      Pages
                                                                                                                                                                                                            8 of 181
                                                   Siemens VDO Automotive AG                                                                                              Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   MISRA Rule 96: In the definition of a function-like macro the whole definition, and
                                                                                   each instance of a parameter, shall be enclosed in parentheses.........................166
                                                                                   QAC Rules: 3409, 3410...............................................................................................166
                                                                                   MISRA Rule 98: There shall be at most one occurrence of the # or ## pre-
                                                                                   processor operators in a single macro definition...................................................167
                                                                                   QAC-Rules: 0880, 0881...............................................................................................167
                                                                                   MISRA Rule 99: All uses of the #pragma directive shall be documented and
                                                                                   explained......................................................................................................................168
                                                                                   QAC-Rule 3116............................................................................................................168
                                                                                   MISRA Rule 100: The defined pre-processor operator shall only be used in one of
                                                                                   the two standard forms..............................................................................................168
                                                                                   QAC 0887, 0888...........................................................................................................168
                                                        3.2.15                           Pointers and Arrays, Misra-Rule: 106*..............................................................169
                                                                                   MISRA Rule 106: The address of an object with automatic storage shall not be
                                                                                   assigned to an object which may persist after the object has ceased to exist.. .169
                                                                                   QAC-Rules: 3216, 3217, 3225, 4140...........................................................................169
                                                        3.2.16                           Structures and Unions, Misra-Rules: 108, 109, 110, 113.................................170
                                                                                   MISRA Rule 108: In the specification of a structure or union type, all members of
                                                                                   the structure or union shall be fully specified.........................................................170
                                                                                   QAC-Rules: 0554, 0545, 0623, 0636, 3310, 3313......................................................170
                                                                                   MISRA Rule 109: Overlapping variable storage shall not be used........................171
                                                                                   No QAC messages cover this rule............................................................................171
                                                                                   MISRA Rule 110: Unions shall not be used to access the sub-parts of larger data
                                                                                   types.............................................................................................................................172
                                                                                   QAC-Rules: 0750, 5110...............................................................................................172
                                                                                   MISRA Rule 113: All the members of a structure (or union) shall be named and
                                                                                   shall only be accessed via their name......................................................................172
dissemination and/or editing of this document as well as utilization of its
                                                        3.2.17 Standard Libraries, Misra-Rules: 114, 115, 118, 119, 120, 121, 122, 123, 124,
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                                Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                     2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                            Designation                                                                                        Status
                                                                                                                                                                                                               released
                                                                                                            Documentkey                                                                                        Pages
                                                                                                                                                                                                               9 of 181
                                                   Siemens VDO Automotive AG                                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                   QAC 4700.....................................................................................................................179
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                                  Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                       2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                             Designation                                                                                          Status
                                                                                                                                                                                                                  released
                                                                                                             Documentkey                                                                                          Pages
                                                                                                                                                                                                                  10 of 181
                                                   Siemens VDO Automotive AG                                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
...
                                                        #endif
                                                        /* end of file */
/* file aioa1c1.c : */
                                                        #ifndef AIOA_C1_H
                                                        #include <aioa1c1.h>
                                                        #endif
                                             This warning is produced because you are using the unary '-' operator on an operand which does not have
inventions, are reserved by VDOTransmittal, reproduction,
                                             struct s { int x; };
                                             int val;
model or design patent are reserved.
                                             struct s field;
                                             val = -field;                                     /* field is not of arithmetic type */
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                Status
                                                                                                                                                                                                   released
                                                                                                        Documentkey                                                                                Pages
                                                                                                                                                                                                   11 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The unary '~' operator can only be applied to operands with integral type. Check the declaration of the operand.
                                             e.g.
                                             struct s { int x; };
                                             int val;
                                             struct s field;
                                             val = ~field;
                                                          0808                              Config              '#include "%s"' causes itself to be included recursively. QA C ignores it after 8
                                                                                                                occurrences.
                                             You have constructed a header file which directly or indirectly includes itself. In the example below the file will be
                                             recursively included indefinitely. QA C terminates recursive inclusion after 8 occurrences. In the example below
                                             the recursion could be prevented by placing the #ifndef _INC_THIS and #define _INC_THIS guard at the top of
                                             the file, i.e. before the #include __FILE__.
#include __FILE__
                                             #ifndef _INC_THIS
                                             #define _INC_THIS
#endif
                                                          0810                            ISO_Limits            [L] '#include "%s"' causes nesting to exceed 8 levels - program is non-
                                                                                                                conforming.
                                             The ISO standard requires that the depth of nesting of conditional inclusion be 8 levels. QAC takes the view that
                                             up to 8 levels can therefore be guaranteed to be handled correctly by any conforming compiler, but that support
                                             for further levels is compiler dependent and hence use of further levels is non-portable.
dissemination and/or editing of this document as well as utilization of its
                                             This message is generated when a file is included twice from the top (i.e. source file) level. This is bad practice
contents and communication there of to others without express
#include "test.h"
                                                                                                                                        Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                 Status
                                                                                                                                                                                                    released
                                                                                                        Documentkey                                                                                 Pages
                                                                                                                                                                                                    12 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             #include "xxxx.h"
                                             It will not be generated for system headers included with a statement of the form:
                                             #include
                                                        0767                             Constraint        [C] 'break' statement found outside a loop or 'switch' statement.
                                             A 'break' statement should only be present in a 'switch' statement as it terminates execution of the enclosing
                                             statement. e.g.
                                             static int
                                             func1(void)
                                             {
                                                int i = 0;
                                                int j = 0;
                                                              if( i && j)
                                                              {
                                                                 break;
                                                              }
                                                              else
                                                              {
                                                                 break;   /* message 0767 */
                                                              }
                                             }
                                             For example:
This document and the information ..............................................
                                                        while (gi != 0)
inventions, are reserved by VDOTransmittal, reproduction,
                                                        {
                                                          gi++;
                                                          if (gi == VALUE)
                                                          {
                                                            break;     /* Message 769 */
model or design patent are reserved.
                                                          }
                                                        }
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                13 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3333                             Min_Ctrl           A break statement shall only be used at the end of all the statements in a
                                                                                                              switch case block.
                                             Break statements should be avoided as far as possible except in switch statements. Any break in control flow
                                             increases complexity which can affect maintainability and reliability. A 'break' can usually be avoided - perhaps by
                                             making the loop termination condition dependent upon a continuation flag. Message 3333 is functionally similar to
                                             message 769 - but is generated only in the context of an if statement within a switch construct..
                                             For example:
                                             switch(n)
                                             {
                                             case 1:
                                                   if (flag == 0)
                                                       break;    /* Message 3333 */
                                                   ...
                                                   break;
                                             case 2:
                                               ...
                                             Tip: to guarantee that with "i = function(1,2,3)" function is a function and not a macro, you can do the following:
                                                           use brackets: i = (function)(1,2,3). Even if you #define function(a,b,c), the preprocessor will not
                                                              apply this definition.
                                                           #undef function before using it.
                                             Example
                                             1. Bad example
                                             #define TCVEL__wGetSpeed() VEL_wGetVelocity (2,3)
                                             ...
                                             TCVEL__funca()
dissemination and/or editing of this document as well as utilization of its
                                             {
the property of VDO. This document and ll information is confidential.
                                                                                                                    /*   a = VEL_wGetVelocity(2,3),                      */
inventions, are reserved by VDOTransmittal, reproduction,
                                             ...
model or design patent are reserved.
                                             2. Testexample
                                             #define TCVEL__wGetSpeed() 5                                            /* Teststub for Testcase xyz - will be deleted after test */
                                             ...
                                             TCVEL__funca()
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  14 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
                                                                    wVelocity = TCVEL__wGetSpeed();                /*   After finishing the test, the                          */
                                                                                                                   /*   adaptation will be deleted,                            */
                                                                                                                   /*   and the internal function                              */
                                                                                                                   /*   TCVEL__wGetSpeed will be used - ok                     */
                                             ...
                                             3. Configurationexample
                                             #if (PROJ==A)
                                                #define SYN_wGetSpeed() VEL_wGetVel()                               /* Different function name in          */
                                                                                                                    /* project A, because not the standard */
                                                                                                                    /* NXDA function is used               */
                                             #else
                                                #define SYN_wGetSpeed() NXD_wGetSpeed() /* In all other projects, the data is */
                                                                                        /* fetched from the norming layer NXDA */
                                             #endif
                                             ...
                                             TCVEL__funca()
                                             {
                                                 wVelocity = SYN_wGetSpeed();       /* This function will be overwritten by */
                                                                                    /* a synonym adaptation in the CI Header */
                                                                                    /* Obvious thanks to the SYN prefix      */
                                             ...
                                             QAC-Rules: Logic
                                             3.1.4 Rule mr2849 | Mandatory
                                             Using unary operators in comparison expressions often will lead to unexpected behaviour. Unary operators in
                                             expressions therefore always must be explicitly casted.
                                             Justification
                                             An unary operator (e.g. "~", "-") is an operation of itself and will typically lead to an unmasked promotion
                                             operation inside the register.
                                             Example
                                             uint8 u8_v1;
                                             uint8 u8_v2;
                                             u8_v1 = ~0xff;
                                             // The result is 0:
                                             // 1. 0x00ff is stored in a register
                                             // 2. inverted leading to 0xff00
                                             // 3. and uint8 casted (assigned to an 8bit variable), leading to 0x0000
u8_v2 = 0xff;
                                             if (u8_v1 == ~0xff)
                                             {
dissemination and/or editing of this document as well as utilization of its
                                             // what about
                                             if (u8_v1 == ~u8_v2)
model or design patent are reserved.
                                             {
                                                 // Same procedure as above
                                             }
                                                                                                                         Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com              2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                     Status
                                                                                                                                                                                     released
                                                                                                     Documentkey                                                                     Pages
                                                                                                                                                                                     15 of 181
                                                   Siemens VDO Automotive AG                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
if (u8_v1 == (uint8)~u8_v2)
                                             struct s { int x; };
                                             int val;
                                             struct s field;
                                             val = -field;                                        /* field is not of arithmetic type */
                                             struct s { int x; };
                                             int val;
                                             struct s field;
                                             val = ~field;
                                             Justification
                                             The calling conventions of a compiler differentiate between specific caller and callee saved registers. Caller
                                             saved registers are those registers, which are saved by the caller of a function and which are often used for
                                             parameter passing. Callee saved registers must be saved by the function using them, e.g. by storing the contents
                                             on the stack and restoring them when leaving the function. When using only C functions, all this is handled by the
                                             compiler.
                                             When intermixing C and assembly code, the callee saved registers must be stored manually. When writing
                                             assembly IRQ routines, typically all registers must be saved before being used. Bugs based on missing saving of
                                             registers will lead to hard to find data inconsistencies with typically fatal impact on the system.
dissemination and/or editing of this document as well as utilization of its
                                             As the calling conventions differ between compilers, special care must be taken when porting code from one
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             compiler to another.
This document and the information ..............................................
                                             Example
                                             The following example shows the principle call of an assembler subroutine in pseudo code
                                             // C caller
                                             erg = AssemblerFunction(1,2);
model or design patent are reserved.
                                             // Assembly Callee
                                             #pragma ASM
                                             // R1, R2 are by convention caller saved and contain the parameters
                                             // R0 is caller saved and contains the return value
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                 Status
                                                                                                                                                                                                    released
                                                                                                        Documentkey                                                                                 Pages
                                                                                                                                                                                                    16 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             // R3 which contains                                   the result is callee saved and must be saved before use
                                             .AssemblerFunction
                                                 PUSH R3                                            //    Save R3 on the stack
                                                 ADD R3, R1, R2                                     //    Calculate the sum of R1 and R2
                                                 MOV R3, R0                                         //    Pass the result to the return value
                                                 POP R3                                             //    Restore R3
                                             When defining an IRQ function, typically no registers are saved automatically by the compiler. Instead, all
                                             registers must be saved manually. Never rely on the assumption, that the registers have not been used before
                                             the IRQ!
                                             .pragma ASM
                                             .IRQFunction
                                             // R1, R2 are used and therefore are stored on the stack
                                                                    InlineASM(
                                                                    // R2 and R3 are used and saved on the stack
                                                                    PUSH R2, R3
                                                                    ....
                                                                    ADD R2, R1, #2    // Intention : R2 = b+2
                                                                                      // A minor change in the application (e.g. in CanStatus,
                                                                                      // Compile options,...) however will result in b
                                                                                      // to be stored in a different register
                                                                                      // resulting in a wrong calculation and data corruption of R1
                                                                    ...
                                                                    )
                                             }
QAC-Rule: Logic
                                             Justification
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             This leads to undefined behavior. Redefining functions from the C standard libraries may lead to confusion and
prior written consent of VDO. All rigths, especially with regard to
                                             unexpected behaviour.
inventions, are reserved by VDOTransmittal, reproduction,
                                             Example
                                             ANSI C reserves identifiers beginning with underline.
                                             Xint _STDC_ =0; /* Trouble!                                                                                                            */
                                                             /* Some compilers will not complain. Others might.                                                                     */
                                                             /* Linkers may be confused and your fellow developers, too                                                             */
model or design patent are reserved.
                                             Note:
                                                                                          For historical reasons, bitfield types from cdef.h (bit8 and bit16) are a exception to this rule.
                                                                                           They provide bit identifiers _0 .. _15.
                                                                                          Standard C also includes Standard C libraries. They define the following standard functions:
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                         Designation                                                                             Status
                                                                                                                                                                                                 released
                                                                                                         Documentkey                                                                             Pages
                                                                                                                                                                                                 17 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             abort, abs, acos, asctime, asin, atan, atan2, atexit, atof, atoi, atol, bsearch, ceil, calloc, clearerr, clock, cos, cosh,
                                             ctime, difftime, div, exit, exp, fabs, fclose, feof, ferror, fflush, fgetc, fgetpos, fgets, floor, fmod, fopen, fprintf, fputc,
                                             fputs, fread, free, freopen, frexp, fscanf, fsetpos, ftell, fwrite, getc, getchar, getenv, gets, gmtime, isalnum,
                                             isalpha, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, labs, ldexp, ldiv, localeconv,
                                             localtime, log, log10, longjmp, malloc, mblen, mbstowcs, mbtowc, memchr, memcmp, memcpy, memmove,
                                             memset, mktime, modf, perror, printf, putc, putchar, puts, qsort, raise, rand, realloc, remove, rename, rewind,
                                             scanf, setbuf, setlocale, setvbuf, sin, sprintf, sqrt, srand, strcmp, sscanf, strcat, strchr, strcoll, strcopy, strcspn,
                                             strerror, strftime, strlen, strncat, strncmp, strncpy, strpbrk, strrchr, strspn, strstr, strtod, strtok, strtol, strtoul,
                                             strxfrm, system, tan, tanh, time, tmpfile, tmpnam, tolower, toupper, ungetc, vfprintf, vprintf, vsprintf, wcstombs,
                                             wctomb
                                             If custom implementations are needed (e.g. for optimization reasons), they must behave like the standard
                                             implementation.
                                            0346                                     Min_KandR               '%s' is an ISO keyword and will not be recognised by K&R compilers.
                                             This is not portable to K&R compilers. Macros can be used to map keywords to nothing.
                                             Non-portable keywords include const, signed, and volatile
                                                          0602                            ISO_ExpU          [U] The identifier '%s' is reserved for use by the library.
                                             This identifier is a reserved identifier and should not be used here. e.g.
                                             int
                                             main (void)
                                             {
                                               int __sigDefault;                                      /*   warning 0602:        */
                                               int __sigIgnore;                                       /*   prefix '__' reserved */
                                               int __sigError;                                        /*   for library use      */
                                               int _sigIgnore;                                        /*   OK */
                                               return 1;
                                             }
                                                          0836                            ISO_ExpU          [U] Definition of macro named 'defined'.
                                             You have attempted to #define a macro called 'defined'. The word 'defined' is a preprocessor operator and it
                                             should never be redefined or undefined. e.g.
                                             #define defined "defined"                 /* illegal */
                                             'defined' is a reserved operator introduced to test for the presence of macro definitions.
                                             It evaluates to 1 if its identifier operand is currently defined as a macro name and to 0 if it is not.
                                             The specified identifier is a recognised C++ keyword. This will normally result in a syntax violation when trying to
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             ...
inventions, are reserved by VDOTransmittal, reproduction,
                                             int class;
                                             ...
                                             'class' is a C++ keyword - avoid using names which duplicate
                                             This keyword is an anachronism in C++ but is still supported by many compilers. e.g.
                                             int overload; /* warning 1301 - may be a keyword: */
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                  Status
                                                                                                                                                                                                  released
                                                                                                     Documentkey                                                                                  Pages
                                                                                                                                                                                                  18 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          0543                            ISO_ExpU            [U] 'void' expressions have no value and may not be used in expressions.
                                             The (nonexistent) value of an expression of type void cannot be used in any way, and implicit or explicit
                                             conversions (except to void) cannot be applied to such an expression. For example:
                                                          0744                            ISO_ExpU            [U] '%s()' has been declared with a non void result type but ends with an
                                                                                                              implicit 'return ;' statement.
                                             This function has been explicitly defined as having a non-void return type but ends with an implicit return
                                             statement which returns no value. This will always return an undefined value. e.g.
                                             float func(void)
dissemination and/or editing of this document as well as utilization of its
                                             {
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                /* no return statement */
This document and the information ..............................................
                                             }
contents and communication there of to others without express
inventions, are reserved by VDOTransmittal, reproduction,
                                                          0745                            ISO_ExpU            [U] 'return;' found in '%s()', which has been defined with a non-'void' return
                                                                                                              type.
                                             This return statement has no return expression although a non-void return type for the function has been defined.
                                             The value returned by the function is undefined. e.g.
model or design patent are reserved.
                                             float func(void)
                                             {
                                                 /* ... */
                                                 return;
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  19 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                   0746                                  Constraint            [C] 'return exp;' found in '%s()' whose result type is 'void'.
                                             The ISO standard forbids the presence of a return statement (with a return expression) in a function whose return
                                             type is 'void'. e.g.
                                             void func(void)
                                             {
                                                int i;
                                                /* ... */
                                                return i;    /* illegal */
                                             }
                                             Justification
                                             Registers do not have adresses. Adressing register variables is not allowed acording to ANSI C (1990).
                                             Example
                                             Sometimes developers try to write more performant code by declaring an array register. Note that no pointer
                                             arithmetic is possible on such arrays, since they are not located in normal storage.
                                             register int arr[MX_SIZE];
                                             int* arr_ptr;
                                             arr_ptr=arr; /* This is not allowed!
                                                           * Where will ‘arr_ptr’ point to physically?
                                                           */
                                                          0304                            ISO_ExpU              [U] The address of an array declared 'register' may not be computed.
                                             Arrays declared with the 'register' storage class specifier should be considered as having no physical address
                                             (although a particular implementation could treat a register declaration as being an auto declaration).
                                             If an array has no computable address then it is illegal to try to take the address either implicitly (through the
                                             conversion of an array name to a pointer) or explicitly with the unary '&' operator. e.g.
                                             register int array[10];
                                             int * ptr = array;      /* probably illegal */
                                                          0454                             Constraint           [C] The address-of operator '&' cannot be applied to an object declared with
                                                                                                                'register'.
dissemination and/or editing of this document as well as utilization of its
                                             In compiled code, when the register hint is given to the compiler, the address of the variable cannot be requested.
damages. All rights created by patent grant or registration of a utility
                                             For example:
This document and the information ..............................................
                                             {
                                                 register int a;
                                                 int *pa;
0775 Constraint [C] '%s': 'register' may not be specified for global declaration.
                                                                                                                                        Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                  Status
                                                                                                                                                                                                     released
                                                                                                        Documentkey                                                                                  Pages
                                                                                                                                                                                                     20 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The 'register' storage class specifier has been applied to a global declaration (with internal or external linkage).
                                             The 'register' specifier can only be used on declarations with function/block scope. e.g.
                                             register int number;             /* illegal at file scope */
                                                          2711                             Min_Decl           'register' is only a hint - the compiler may well be able to do a better job of
                                                                                                              optimising - avoid!
                                             Use of the keyword register is no longer needed. Most modern compilers will optimise variables into registers
                                             doing a better job of optimisation than a programmer could. It is best to avoid using the keyword register.
                                             void
                                             fn(void)
                                             {
                                                register int i;                                        /* 'register' only a compiler hint*/
                                                /* ... */
                                             }
                                             Better to remove the 'register' storage-class specifier.
                                                          3620                             Maj_Decl           'register' may be illegal on array and 'struct' / 'union' types in some compilers.
                                             This is legal in the ISO standard but some compilers may complain.
                                             short                                 s;
                                             int                                   i;
                                             float                                 f;
                                             double                                d;
...
                                             /* if it is guaranteed that all legal values for "i" in this context will
                                              * fit into s do an explicit cast and comment it:
                                              */
                                             QAC-Rules:
inventions, are reserved by VDOTransmittal, reproduction,
                                             3700 – 3713, 3715, 3717, 3719, 3720 – 3723, 3725, 3727, 3729, 3730 – 3736, 3738, 3740 – 3748, 3750, 3752 –
                                             3760, 3762 – 3772, 3774- 3807, 3810 – 3819, 3821 - 3834, 3837, 3839, 3840, 3843, 3844, 3847, 3848, 3850 -
                                             3881, 3892, 3900 – 3913, 3915, 3917, 3919 - 3923, 3925, 3927, 3929 - 3936, 3938, 3940 – 3948, 3950, 3952 -
                                             3960, 3962 – 3972, 3974 – 4007, 4010 - 4019, 4021- 4034, 4037, 4039, 4040, 4043, 4044, 4047, 4048, 4050 -
                                             4081
model or design patent are reserved.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   21 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The result of a conversion to or from a plain 'char' datatype will depend on whether the plain 'char' datatype is
inventions, are reserved by VDOTransmittal, reproduction,
signed or unsigned. This is implementation defined behaviour and it is not wise to make any assumptions.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   22 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  23 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   24 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                       Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     25 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   26 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A signed datatype is being converted to an unsigned datatype and negative values will be converted to large
the property of VDO. This document and ll information is confidential.
                                             positive values.
This document and the information ..............................................
                                                                                                                                        Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    27 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             An unsigned value is being converted to a signed type - the result may be negative.
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   28 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Data is being converted to a smaller datatype. This may result in a loss of information
inventions, are reserved by VDOTransmittal, reproduction,
                                             A signed datatype is being converted to an unsigned datatype and negative values will be converted to large
                                             positive values.
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   29 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Data is being converted to a smaller datatype. This may result in a loss of information
This document and the information ..............................................
                                             An unsigned value is being converted to a signed type - the result may be negative.
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    30 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   31 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                        Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    32 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                      Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     33 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   34 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    35 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             An object of type long long is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   36 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  37 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             For example:
                                             int a;
                                             int b;
                                             a = (float)b;                                   /* b is explicitly cast to float, the result is then implicitly cast to int
model or design patent are reserved.
*/
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    38 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Implicit casts should be avoided. The result of a conversion to or from a plain 'char' datatype will depend on
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             whether the plain 'char' datatype is signed or unsigned. This is implementation defined behaviour and it is not
This document and the information ..............................................
                                                                                                                                      Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                    Status
                                                                                                                                                                                                     released
                                                                                                      Documentkey                                                                                    Pages
                                                                                                                                                                                                     39 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3912                            Maj_UStoS           unsigned char value returned from signed char %s().
                                             An object of type unsigned char is being implicitly cast to a signed char.
                                             Implicit casts should be avoided. An unsigned value is being converted to a signed type - the result may be
                                             negative.
                                                          3921                             Maj_ItoFL          unsigned char value returned from long double %s().
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             whether the plain 'char' datatype is signed or unsigned. This is implementation defined behaviour and it is not
                                             wise to make any assumptions. It is safer not to mix 'char' types in expressions.
3923 Maj_StoUS signed char value returned from unsigned char %s().
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 40 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3925                            Maj_StoUS           signed char value returned from unsigned short %s().
                                             An object of type signed char is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
                                                          3927                            Maj_StoUS           signed char value returned from unsigned int %s().
                                             An object of type signed char is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
                                                          3929                            Maj_StoUS           signed char value returned from unsigned long %s().
                                             An object of type signed char is being implicitly cast to an unsigned long.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
                                                          3932                             Maj_ItoFL          signed char value returned from long double %s().
                                             An object of type signed char is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                             When a value is converted to a smaller type and the result cannot be represented the result will depend on the
                                             implementation.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 41 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             )
                                             {
                                                              short x;
                                                              return x;
                                             }
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
damages. All rights created by patent grant or registration of a utility
                                             values.
This document and the information ..............................................
                                             {
                                                 short ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                                                                                                                     Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     42 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3945                            Maj_UStoS           unsigned short value returned from signed char %s().
dissemination and/or editing of this document as well as utilization of its
                                             A value of type unsigned short is being returned from a function that is defined with type signed char.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             {
                                                 unsigned short ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
model or design patent are reserved.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                              Status
                                                                                                                                                                                                released
                                                                                                       Documentkey                                                                              Pages
                                                                                                                                                                                                43 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3946                            Maj_Small           unsigned short value returned from unsigned char %s().
                                             A value of type unsigned short is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 unsigned short ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  44 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3954                             Maj_ItoFL          unsigned short value returned from long double %s().
                                             A value of type unsigned short is being returned from a function that is defined with type long double.
                                             The situation is illustrated below:
                                             long double foo ( void )
                                             {
                                                  unsigned short ret;
                                                  /* ... */
                                                  return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                                 int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
model or design patent are reserved.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
                                             values.
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  45 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
                                                 int ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
model or design patent are reserved.
values.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   46 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type int is being returned from a function that is defined with type float.
                                             The situation is illustrated below:
                                             float foo ( void )
                                             {
                                                 int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                 return(ret);
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             }
This document and the information ..............................................
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
inventions, are reserved by VDOTransmittal, reproduction,
The result of a conversion to or from a plain 'char' type is dependent on whether plain 'char' is signed or not.
                                                          3967                            Maj_UStoS           unsigned int value returned from signed char %s().
                                             A value of type unsigned int is being returned from a function that is defined with type signed char.
model or design patent are reserved.
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    47 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /* ... */
                                                                    return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3968                         Maj_Small    unsigned int value returned from unsigned char %s().
                                             A value of type unsigned int is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                                          3970                            Maj_Small          unsigned int value returned from unsigned short %s().
                                             A value of type unsigned int is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
dissemination and/or editing of this document as well as utilization of its
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             A value of type unsigned int is being returned from a function that is defined with type int.
                                             The situation is illustrated below:
                                             int foo ( void )
                                             {
                                                 unsigned int ret;
model or design patent are reserved.
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                48 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
When an unsigned type is converted to a signed type, the result may be negative.
                                                          3976                             Maj_ItoFL          unsigned int value returned from long double %s().
                                             A value of type unsigned int is being returned from a function that is defined with type long double.
                                             The situation is illustrated below:
                                             long double foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
dissemination and/or editing of this document as well as utilization of its
                                             A value of type long is being returned from a function that is defined with type char.
                                             The situation is illustrated below:
                                             char foo ( void )
                                             {
                                                 long ret;
model or design patent are reserved.
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                                                                                                                     Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   49 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
The result of a conversion to or from a plain 'char' type is dependent on whether plain 'char' is signed or not.
                                             A value of type long is being returned from a function that is defined with type unsigned short.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             {
                                                 long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
model or design patent are reserved.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
                                             values.
                                                                                                                                    Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   50 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
                                                 long ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    51 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3989                            Maj_UStoS           unsigned long value returned from signed char %s().
                                             A value of type unsigned long is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
dissemination and/or editing of this document as well as utilization of its
                                                 return(ret);
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             }
prior written consent of VDO. All rigths, especially with regard to
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3990                            Maj_Small           unsigned long value returned from unsigned char %s().
model or design patent are reserved.
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                              Status
                                                                                                                                                                                                released
                                                                                                       Documentkey                                                                              Pages
                                                                                                                                                                                                52 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3992                            Maj_Small          unsigned long value returned from unsigned short %s().
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             When an unsigned type is converted to a signed type, the result may be negative.
This document and the information ..............................................
                                                          3994                            Maj_Small          unsigned long value returned from unsigned int %s().
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned int.
                                             The situation is illustrated below:
                                             unsigned int foo ( void )
                                             {
model or design patent are reserved.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                53 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                    3998                              Maj_ItoFL     unsigned long value returned from long double %s().
                                             A value of type unsigned long is being returned from a function that is defined with type long double.
dissemination and/or editing of this document as well as utilization of its
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    54 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                 float ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                                                                                                                     Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     55 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
This document and the information ..............................................
                                                 float ret;
contents and communication there of to others without express
                                                 /* ... */
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                      Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    56 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
damages. All rights created by patent grant or registration of a utility
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                              Status
                                                                                                                                                                                                released
                                                                                                       Documentkey                                                                              Pages
                                                                                                                                                                                                57 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             A value of type double is being returned from a function that is defined with type unsigned long.
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             {
                                                 double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
model or design patent are reserved.
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    58 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type double is being returned from a function that is defined with type float.
                                             The situation is illustrated below:
                                             float foo ( void )
                                             {
                                                 double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4022                             Maj_FLtoI          long double value returned from signed char %s().
                                             A value of type long double is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
                                             {
                                                  long double ret;
                                                  /* ... */
                                                  return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4023                             Maj_FLtoI          long double value returned from unsigned char %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                  long double ret;
dissemination and/or editing of this document as well as utilization of its
                                                  /* ... */
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                  return(ret);
This document and the information ..............................................
                                             }
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 59 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /* ... */
                                                                    return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4025                             Maj_FLtoI          long double value returned from unsigned short %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4027                             Maj_FLtoI          long double value returned from unsigned int %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned int.
                                             The situation is illustrated below:
                                             unsigned int foo ( void )
                                             {
                                                  long double ret;
                                                  /* ... */
                                                  return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
dissemination and/or editing of this document as well as utilization of its
                                             A value of type long double is being returned from a function that is defined with type long.
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 60 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4029                             Maj_FLtoI          long double value returned from unsigned long %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned long.
                                             The situation is illustrated below:
                                             unsigned long foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4033                            Maj_Pchar           char value returned from unsigned long long %s().
dissemination and/or editing of this document as well as utilization of its
                                                          4034                           Maj_UStoLS           unsigned char value returned from long long %s().
                                             An object of type unsigned char is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
model or design patent are reserved.
                                                          4037                            Maj_StoUS           signed char value returned from unsigned long long %s().
                                             An object of type signed char is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 61 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4039                            Maj_StoUS          short value returned from unsigned long long %s().
                                             An object of type short is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4040                           Maj_UStoLS          unsigned short value returned from long long %s().
                                             An object of type unsigned short is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4043                            Maj_StoUS          int value returned from unsigned long long %s().
                                             An object of type int is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                             QAC-Rule 4044
                                                          4044                           Maj_UStoLS          unsigned int value returned from long long %s().
                                             An object of type unsigned int is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4047                            Maj_StoUS          long value returned from unsigned long long %s().
                                             An object of type long is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4048                           Maj_UStoLS          unsigned long value returned from long long %s().
                                             An object of type unsigned long is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4051                            Maj_Small          long long value returned from signed char %s().
                                             An object of type long long is being implicitly cast to a signed char.
                                             Implicit casts should be avoided.
                                                          4052                            Maj_StoUS          long long value returned from unsigned char %s().
dissemination and/or editing of this document as well as utilization of its
                                                          4054                            Maj_StoUS          long long value returned from unsigned short %s().
                                             An object of type long long is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                62 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4056                            Maj_StoUS           long long value returned from unsigned int %s().
                                             An object of type long long is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided.
                                                          4057                            Maj_Small           long long value returned from long %s().
                                             An object of type long long is being implicitly cast to a long.
                                             Implicit casts should be avoided.
                                                          4058                            Maj_StoUS           long long value returned from unsigned long %s().
                                             An object of type long long is being implicitly cast to an unsigned long.
                                             Implicit casts should be avoided.
                                                          4059                            Maj_StoUS           long long value returned from unsigned long long %s().
                                             An object of type long long is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4062                             Maj_ItoFL          long long value returned from long double %s().
                                             An object of type long long is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                                          4063                            Maj_Pchar           unsigned long long value returned from char %s().
                                             An object of type unsigned long long is being implicitly cast to a char.
                                             Implicit casts should be avoided.
                                                          4064                            Maj_UStoS           unsigned long long value returned from signed char %s().
dissemination and/or editing of this document as well as utilization of its
                                             An object of type unsigned long long is being implicitly cast to a signed char.
This document and the information ..............................................
                                                          4065                            Maj_Small           unsigned long long value returned from unsigned char %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned char.
                                             Implicit casts should be avoided.
model or design patent are reserved.
                                                          4066                            Maj_UStoS           unsigned long long value returned from short %s().
                                             An object of type unsigned long long is being implicitly cast to a short.
                                             Implicit casts should be avoided.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 63 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4067                            Maj_Small           unsigned long long value returned from unsigned short %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided.
                                                          4068                            Maj_UStoS           unsigned long long value returned from int %s().
                                             An object of type unsigned long long is being implicitly cast to an int.
                                             Implicit casts should be avoided.
                                                          4069                            Maj_Small           unsigned long long value returned from unsigned int %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided.
                                                          4070                            Maj_UStoS           unsigned long long value returned from long %s().
                                             An object of type unsigned long long is being implicitly cast to a long.
                                             Implicit casts should be avoided.
                                                          4071                            Maj_Small           unsigned long long value returned from unsigned long %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned long.
                                             Implicit casts should be avoided.
                                                          4072                            Maj_UStoS           unsigned long long value returned from long long %s().
                                             An object of type unsigned long long is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4074                             Maj_ItoFL          unsigned long long value returned from double %s().
                                             An object of type unsigned long long is being implicitly cast to a double.
                                             Implicit casts should be avoided.
                                                          4075                             Maj_ItoFL          unsigned long long value returned from long double %s().
                                             An object of type unsigned long long is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                                          4076                             Maj_FLtoI          float value returned from long long %s().
                                             An object of type float is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
dissemination and/or editing of this document as well as utilization of its
                                                          4077                             Maj_FLtoI          float value returned from unsigned long long %s().
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                          4079                             Maj_FLtoI          double value returned from unsigned long long %s().
                                             An object of type double is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 64 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4080                             Maj_FLtoI          long double value returned from long long %s().
                                             An object of type long double is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4081                             Maj_FLtoI          long double value returned from unsigned long long %s().
                                             An object of type long double is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                             Justification
                                             A common source of error is the use of deallocated pointers, de-referencing null pointers, and improper pointer
                                             alignment after casting pointers to a different type.
                                             Note: Because the behaviour of corrupt pointers is different on an emulator and flash system, these bugs are
                                             extremely hard to track and the concequences of a pointer bug typically are fatal - corrupted memory (pointing to
                                             RAM) or loss of data (pointing to ROM).
                                             Example
                                             ...
                                             int8* EEPX_pi8DataBuffer = malloc();
                                             ...
                                             if(...)
                                                 ...
                                                 free EEPX_pi8DataBuffer;
                                             ....
                                             /* make sure the pointer is still valid !!! */
                                             if (EEPX_piDataB8uffer != NULL)
                                             {
                                               EEPX_sData2String(EEPX_pi8DataBuffer);
                                             ...
                                             QAC-Rules: 0306, 0307, 0308, 0309, 0310, 0311, 0312, 0313, 0431, 0432, 0488, 0489, 0562, 0563, 0673, 0757,
                                             3003, 3216, 3217, 4140
                                                          0306                           ISO_ImplDef           [I] Cast between pointer and integral type is implementation defined.
                                             It is dangerous to cast to and from integers as the implementation defines the size of the integer required and the
dissemination and/or editing of this document as well as utilization of its
                                             result of the cast. This could result in a loss of information. The exception is the casting of integer value zero
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             (2) Casting of a pointer to a function of one type to a pointer to a function of another type (and back again)
                                             provided that no attempt is made to execute the function between casts (as the function return type would
                                             obviously disagree with the intermediate pointer type and therefore lead to undefined behaviour).
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    65 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             p = (struct x*)&i;
                                             attempts to take the address of 'i' and convert it to an address of an incomplete type.
                                             incomplete type - any type which describes an object for which information required to determine its size is
                                             missing.
                                                          0309                            ISO_ExpU          [U] Integral type is not large enough to hold a pointer value.
                                             The receiving integral type is not large enough to hold the value of the pointer being cast to it. This means that
                                             during the casting it is very likely that information will be lost - the value of the integral type will no longer
                                             represent the location held by the pointer.
                                             There are two situations under which casting between pointers is safe. Those are:
                                             (1) Casting of a pointer to another pointer with the same or less strict alignment and back again.
                                             (2) Casting of a pointer to a function of one type to a pointer to a function of another type (and back again)
                                             provided that no attempt is made to execute the function between casts (as the function return type would
                                             obviously disagree with the intermediate pointer type and therefore lead to undefined behaviour).
                                             According to the ISO standard (6.3.16.1), a pointer can only be assigned to another pointer if "both operands are
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left has all of the
contents and communication there of to others without express
                                             qualifiers of the type pointed to by the right". An assignment statement which violates this rule will generate the
inventions, are reserved by VDOTransmittal, reproduction,
                                             constraint error message 562. On the other hand, if the right hand operand is the subject of an appropriate cast,
                                             such an assignment is allowed. Such casts must be considered dangerous and a warning message is generated.
                                             Message 311 indicates that const qualification has been lost from the object pointed to. Message 312 indicates
                                             that volatile qualification has been lost from the object pointed to.
model or design patent are reserved.
                                             For example:
                                                                    int                            *pi;                     /* Ptr. to int                                   */
                                                                    const                int       *pci;                    /* Ptr to con. int                               */
                                                                    ...
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                 Status
                                                                                                                                                                                                 released
                                                                                                     Documentkey                                                                                 Pages
                                                                                                                                                                                                 66 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          0431                             Constraint          [C] Pointer argument has differently qualified base type.
                                             Pointer is converted and may be invalid. The behaviour is undefined.
                                             this rule is to increment or decrement a pointer; this operation is trapped by message 489.
This document and the information ..............................................
                                             For example:
contents and communication there of to others without express
                                                                    int   *px;
inventions, are reserved by VDOTransmittal, reproduction,
                                                                    /* ... */
                                                                    px = px + 2;   /* Message 488 */
                                                                    ++px;        /* OK */
model or design patent are reserved.
                                                          0489                             Min_Ops              Arithmetic operations shall not be performed on pointers - even with the value
                                                                                                                "1"..
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                 Status
                                                                                                                                                                                                    released
                                                                                                        Documentkey                                                                                 Pages
                                                                                                                                                                                                    67 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             This message, 489, will be used in conjunction with message 488. Message 488 is generated whenever a pointer
                                             is the subject of an arithmetic operation. However increment and decrement operations are specifically excluded
                                             from message 488 and are trapped by 489.
                                             For example:
                                                                    int   *px;
                                                                    /* ... */
                                                                    px = px + 2;   /* Message 488 */
                                                                    px = px - 1;    /* Message 489 */
                                                                    ++px;        /* Message 489 */
                                                          0562                             Constraint           [C] Right operand of assignment is a pointer to a differently qualified base type.
                                             The ISO standard requires that in a simple assignment when both operands are pointers to qualified or
                                             unqualified versions of compatible types, the type pointed to by the left has all the qualifiers of the type pointed to
                                             by the right. For example:
                                             static void f(void)
                                             {
                                                 char*       cp;
                                                 const char* ccp;
                                                                    cp=ccp;
                                             }
                                                          0563                             Constraint           [C] Right operand of assignment does not have a compatible pointer type.
                                             The C language does not permit implicit conversion of pointers. A pointer object can only be initialised or
                                             assigned a value which is a pointer to a compatible type. For example:
                                             static void fn(void)
                                             {
                                                 const int* const ip = 0;
                                                 char*            cp;
                                                 cp = ip;    /* Message 0563 */
                                             }
                                                          0673                             Constraint          [C] Pointer initializer has a differently qualified base type.
                                             You have attempted to initialize an object of pointer type with a pointer type object of differing qualification.
                                             Typically qualification refers to const qualification. For example:
                                                          0757                             Constraint           [C] 'return' expression is a pointer to a differently qualified type than the
This document and the information ..............................................
                                             On execution of a return statement, the value of the expression returned is the value of the expression part of the
                                             return statement. If the expression has a type different from that of the function in which it appears, it is converted
                                             as if it were *assigned* to an object of that type. In the example below the function return type is int*, but the type
                                             of the expression provided to the return statement is 'signed volatile int*'.
                                             int* fn(signed volatile int* p1)
model or design patent are reserved.
                                             {
                                               return p1; /* return type mismatch */
                                             }
                                                                                                                                        Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                  Status
                                                                                                                                                                                                     released
                                                                                                        Documentkey                                                                                  Pages
                                                                                                                                                                                                     68 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3216                             Maj_Ops            Address of object being assigned has more restricted scope than object being
                                                                                                              assigned to.
                                             Once the object that was assigned goes out of scope, the contents of the object that was assigned to no longer
                                             points to valid data. For example:
                                             int main()
                                             {
                                                 int *a;
                                                 {
                                                     int b;
                                                     a = &b;
                                                 }
                                                 /* value in 'a' is pointing to data out of scope! */
                                             }
                                                          3217                             Maj_Ops            The address of a local variable is being assigned to a static variable which
                                                                                                              persists when the memory for the local variable is freed.
                                             Assigning the address of a local variable to a static variable is dangerous, since once the local variable goes out
                                             of scope, the address the static variable points to is invalid. For example:
                                             void f(void)
                                             {
                                                 static int* v;
                                                 int a;
                                                 v = &a; /* Can I always access 'a' through '*v' ? */
                                                 /* NO! The address of 'a' could change across function calls */
                                             }
                                                 /* ... */
damages. All rights created by patent grant or registration of a utility
                                             }
inventions, are reserved by VDOTransmittal, reproduction,
                                             If different lifetime is needed, there must exist a syncronisation mechanism, that invalidates the large scope
                                             pointer (e.g. assign NULL) when the object is deleted.
Justification
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 69 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Different scopes may lead to pointers that reference deallocated memory, which cause run time errors when
                                             used. A typical example is the return of a local address:
                                             Example
                                             /* DLIB__pbDataStart : global pointer
                                              * pbRxParmBuffer     : pointer to local data
                                              */
                                             /* ret_val goes out of scope. It’s existence on the stack is pure chance.
                                              * In short test examples this often works, in systems under stress this WILL go
                                              * wrong!
                                              */
                                             int f()
                                             {
                                                char * myString = my_func();                                        /* myString will point to deallocated memory! */
                                             }
                                             Note that ANSI C does not require const data to be located at read-only sections. So you can not use const to
                                             solve the deallocation problem. The following variation works with more compilers than the previous example
                                             (even under stress), but still is not portable.
                                             char* const my_func(void) /* returns pointer to constant string */
                                             {
                                                 char* const ret_val = "STR_INITIALIZER";
                                                 return ret_val;
                                             }
/* ret_val goes out of scope. What it points to is const and therefore still exists */
                                             int f()
                                             {
                                                char * const myString = my_func();                                         /*   myString MAY point to deallocated */
                                                                                                                           /*   memory!                           */
                                             }
dissemination and/or editing of this document as well as utilization of its
                                                          3216                             Maj_Ops           Address of object being assigned has more restricted scope than object being
                                                                                                             assigned to.
                                             Once the object that was assigned goes out of scope, the contents of the object that was assigned to no longer
                                             points to valid data. For example:
model or design patent are reserved.
                                             int main()
                                             {
                                                 int *a;
                                                 {
                                                     int b;
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               70 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                        a = &b;
                                                                    }
                                                                    /* value in 'a' is pointing to data out of scope! */
                                             }
                                                          3217                             Maj_Ops            The address of a local variable is being assigned to a static variable which
                                                                                                              persists when the memory for the local variable is freed.
                                             Assigning the address of a local variable to a static variable is dangerous, since once the local variable goes out
                                             of scope, the address the static variable points to is invalid. For example:
                                             void f(void)
                                             {
                                                                    static int* v;
                                                                    int a;
                                                                    v = &a; /* Can I always access 'a' through '*v' ? */
                                                                    /* NO! The address of 'a' could change across function calls */
                                             }
                                                          3348                             Maj_Stmt           This function argument points to uninitialised data, but the receiving parameter
                                                                                                              is declared as a pointer to const.
                                             It may be appropriate to pass a pointer to some uninitialised data as an argument to a function that will then
                                             initialise the data. However, it can never be appropriate to pass such a pointer to a function if the corresponding
                                             parameter is declared as "pointer to const", because no initialisation is possible. For example:
                                             extern int foo2(const int *p);
                                             int foo1(void)
                                             {
                                                 int y;
                                                 int r;
dissemination and/or editing of this document as well as utilization of its
                                                                    ...
This document and the information ..............................................
                                                          3349                             Maj_Stmt           This function argument may point to uninitialised data, but the receiving
                                                                                                              parameter is declared as a pointer to const.
                                             This message will be generated if there is some possibility that the function argument points to uninitialised data.
model or design patent are reserved.
                                             It may be appropriate to pass a pointer to some uninitialised data as an argument to a function that will then
                                             initialise the data. However, it can never be appropriate to pass such a pointer to a function if the corresponding
                                             parameter is declared as "pointer to const", because no initialisation is possible. For example:
                                             extern int foo2(const int *p);
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 71 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             int foo1(int a)
                                             {
                                                 int x;
                                                 int r;
                                                                    if (a == 1)
                                                                    {
                                                                        x = 1;
                                                                    }
                                             Justification
                                             Omitting parentheses around macro bodies and parameters can lead to unexpected interpretation of the
                                             expanded code (as in the AWFUL example given below).
                                             Example
                                             /*These                                are alright: */
                                             #define                                OK 0
                                             #define                                GOOD (-1)
                                             #define                                SQUARE(a) ((a) * (a))
                                             Note:
This document and the information ..............................................
                                             If the macro definition is a simple constant definition - even one with a cast operator - the brackets need not to be
contents and communication there of to others without express
                                             there.
inventions, are reserved by VDOTransmittal, reproduction,
                                             This message is only generated if the macro body contains operators and is not enclosed in ( ). If these operators
                                             and the operands on which they operate are not enclosed within parentheses then use of the macro in certain
                                             contexts could give rise to unexpected results. Parenthesising macro bodies prevents unexpected precedence
                                             problems and improves reliability.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 72 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             For example:
                                             #define ADD(a,b) a + b
                                             /* ... */
                                             x = 2 * ADD( 1, 2 );
                                             /* ... */.
                                             This statement expands to "x = 2 * 1 + 2" which gives rise to confusion over the intended precedence. The macro
                                             definition would have been better written as:
                                             #define ADD(a,b) ((a) + (b))
                                                 int b=5;
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             This evaluates to ( 3+5*3+5 ) = (3+(5*3)+5) = 23, whereas the required result was probably 64.
inventions, are reserved by VDOTransmittal, reproduction,
                                             Exception: Pointers and arrays do not need a type declaration, but a type declaration is permitted for complex
                                             data types.
Justification
                                                                                                                                     Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   73 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             First, the standard C types int, char, short und long have implicit attributes (sign, size) that are implementation
                                             defined. Basic types from cdef.h are fully qualified, leading to better portability.
                                             Second, bitfield implementation is compiler specific. Accessing bitfield memory with a non-bitfield variable (e.g.
                                             16 bits via 2 bytes) requrires detailed knowledge about the compiler behaviour regarding byte sequence
                                             (endianess), bit sequence and bit stuffing. This knowledge is provided by the various versions of cdef.h. Each
                                             defines union types bit8 and bit16 that allow to access bitfields via byte or short.  
                                             The following table lists the basic types in cdef.h (Note: the types marked with old should not
                                             be used for new implementations, but are accepted in old implementations. It is recommended
                                             however, to change the definitions to new types when maintenance activities take place):
                                           Basic type                                          Description                         Example
                                                                                                                                   EEPX_bi16Example.W = 0xFFFF;
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
                                                                                                                                   bit32 EEPX_bi32Example;
inventions, are reserved by VDOTransmittal, reproduction,
                                              
                                             Example
                                             This example shows 2 type definitions based directly and indirectly on cdef.h.
                                             /* A1c1.h: */
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                              Status
                                                                                                                                                                                               released
                                                                                                      Documentkey                                                                              Pages
                                                                                                                                                                                               74 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
#include "cdef.h"
                                             /* B1c1.h: */
                                               #include "A1c1.h"
                                             Note
                                                  Because int is the "natural" data format, it may decrease performance to give high frequently used
                                                    variables another type. Note that optimizations like this are always platform specific and might decrease
                                                    portability.
                                                  Note that float and double should not be used, because FPUs are not available. Float types are
                                                    implementation defined and require cdef support ( e.g. float24 for 6byte floats)
QAC-Rules: --
                                              
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             Justification
                                             Ignoring this rule will obviously lead to totally different interpretation of the code in a C and C++ environment. In
                                             some cases this will produce syntax errors, which can fairly easyly be fixed, however, there are cases in which
                                             legal constructs evolve, leading to semantic errors, that are very hard to find.
model or design patent are reserved.
                                             Example
                                             This example uses a function "new" which will cause an error when read by a C++ compiler:
                                                                                                                                 Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                      2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                              Status
                                                                                                                                                                                              released
                                                                                                     Documentkey                                                                              Pages
                                                                                                                                                                                              75 of 181
                                                   Siemens VDO Automotive AG                                                                                Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             int var = new(something); /* "new" is an operator in C++ that does not return int
                                             */
                                             Justification
                                             Compilers interpret special characters differently. Most compilers do not acccept them in identifiers.
                                             Example
                                             None
                                             Example
model or design patent are reserved.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                76 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                          MOV_u8EngineViaSatteliteBusTriggerHighPulseStatus and
                                                                                           MOV_u8EngineViaSatteliteBusTriggerLowPulseStatus are too long and the difference is only
                                                                                           visible in the middle of the name. OK for a automated parser, but not for a human reader.
                                             Module Prefix
                                             The module prefix states the source and also the place of definition of an identifier.
                                             Formation rules:
                                                            Module name (without version label!)
                                                            3 to 5 characters
                                                            All characters are written in UPPER CASE.
                                             There is no module prefix for function-local and system-relevant (global macros, global definitions) identifiers.
                                             The module prefix may not be used for individual elements of unions or structures, as it is already given in the
                                             name of the union/structure. Enumerated constants (for non-module-local lists) must use the module-prefix as
                                             they are treated like normal constants. Compilers do no type-checking on them!
                                             Note: A system-relevant identifier has the same scope like a system wide identifier. He does not belong to a
                                             specific module but is defined in system files like cdef.h, sysconst.h etc.
                                             Scope
                                             Scope defines the valid area of an identifier, i.e. where it is "visible".
                                             Definition: "system-wide"
                                             A system-wide identifier has a meaning throughout the system and can be imported by other modules.
                                             Declaration is done in the C1.H file.
                                             Definition: "module-global"
                                             A module-global variable has a meaning only within the module (a module may comprise more than one source-
                                             file). When the module comprises only one file, "module-global" is identical to "file-local". Module global variables
                                             are declared in the Cx.C files, access from other internal module files is done via extern. 
                                             Definition: "file-local"
                                             A file-local identifier has a meaning only within its own file. File local variables should be declared as static inside
                                             the Cx.C file using the variable. File-local identifiers are often used only for debugging purposes.
                                             Definition: "function-local"
                                             A function-local identifier has a meaning only within its own function. Function local variables are declared inside
                                             the function using the variable.
                                             Formation rules:
                                                             0 underscore: function local, no module prefix         (e.g. u8Byte)
                                                             1 underscore: system-wide                                         (e.g. EEPX_u8Byte)
                                                             2 underscores: module-global or file-local                (e.g. EEPX__u8Byte)
                                             Identifiers that begin with an underscore are not allowed (they are reserved for the compiler). Therefore the scope
                                             underline characters are only inserted for identifiers with a module-prefix.
                                              
                                             Type Identifier
dissemination and/or editing of this document as well as utilization of its
                                             The type gives information on the usage type of the identifier. This needs to be carefully selected for complex
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             types.
This document and the information ..............................................
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               77 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                           basic type
                                                                                          'c'                                char
                                           identifier
                                                                                          'i8'                               int8
dissemination and/or editing of this document as well as utilization of its
                                                                                          'i16'                              int16
This document and the information ..............................................
                                                                                          'i32'                              int32
inventions, are reserved by VDOTransmittal, reproduction,
'f' float
                                                                                          'd'                                double
model or design patent are reserved.
'bo' bool
'v' void
                                                                                                                                        Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                       Status
                                                                                                                                                                                                       released
                                                                                                     Documentkey                                                                                       Pages
                                                                                                                                                                                                       78 of 181
                                                   Siemens VDO Automotive AG                                                                                         Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
'un' union
'st' structure
'en' enum
'bi8' bit8
'bi16' bit16
'bi32' bit32
                                             Suffix
                                             A suffix is an optional extension of the identifier's description:
                                             Formation rules:
                                                            Always begins with an underscore.
                                                            Second character is upper case.
                                                            The rest of the characters are lower case.
                                             The following suffixes are defined:
                                           Suffix                                    Meaning
_Alm Alarm
_Ctr Counter
                                           _Flg                                      Flag
model or design patent are reserved.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 79 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
_Len Length
_Msg Message
_Msk Mask
_Tbl Table
_Tim Time
_Tmr Timer
_Tsk Task
                                             Justification
This document and the information ..............................................
                                             The module prefix represents some kind of namespace to avoid naming conflicts across modules. Scope, type
inventions, are reserved by VDOTransmittal, reproduction,
                                             identifier and suffix provide essential information for those who can not reach it easily via development IDE,
                                             because they must use external tools like debugger or symbol generator.
                                             Examples
                                             Here are some definitions from file EEPX1C1.C . The non-name part of the identifiers are printed in bold and
model or design patent are reserved.
                                             explained by comment. Name parts are printed italic. "allocation id." stands for "allocation identifier", which
                                             is part of the type identifier.
                                             EEPX_vSystemGlobalFunction(...);                                           /* module prefix : EEPX                                                    */
                                                                                                                                   Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                80 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             typedef enum
                                             {
                                               EEPX_nSyntaxCmd,                                                    /*   module prefix :    EEPX                                              */
                                                                                                                   /*   scope         :    1 underscore = system wide                        */
                                                                                                                   /*   allocation id.:    n = numeric constant                              */
                                                                                                                   /*   data type     :    none                                              */
                                                                                                                   /*   suffix        :    none                                              */
EEPX_nSyntaxData /* dito */
                                                                                                                   /*   allocation id.:    n                           */
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                                                                                   /*   data type     :    u8                          */
This document and the information ..............................................
                                                                                                                   /*   suffix        :    none                        */
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                              Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                   2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                          Status
                                                                                                                                                                                          released
                                                                                                     Documentkey                                                                          Pages
                                                                                                                                                                                          81 of 181
                                                   Siemens VDO Automotive AG                                                                            Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
/* suffix : none */
QAC-Rules:--
                                             Justification
dissemination and/or editing of this document as well as utilization of its
                                             Usually proprietary syntax provides more control on the compiler output than ANSI C. This benefit conflicts with a
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             decrease in portability. To solve this conflict organize the code so that porting efforts are minimal.
prior written consent of VDO. All rigths, especially with regard to
                                             Example
                                             There is no general solution how to enclose compiler specific syntax. Here are some suggestions. You have to
                                             choose one that fits closest to your needs.
                                             1. Consider redesign such that ANSI C behaviour is closer to your needs.
                                             For example, if you have performance problems due to many function entrances/exits in a deeply nested
model or design patent are reserved.
                                             hierarchy of function calls, consider hierarchy flattening prior to compiler specific inlining. As an additional benefit,
                                             this should improve compiler output for other compilers, too.
2. Isolate compiler specific code sections in separate files. To port the code, copy them and adapt proprietary
                                                                                                                               Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                    2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                           Status
                                                                                                                                                                                           released
                                                                                                     Documentkey                                                                           Pages
                                                                                                                                                                                           82 of 181
                                                   Siemens VDO Automotive AG                                                                             Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             syntax to a new compiler in these copies. Use the Preprocessor or configuration management tool to ensure that
                                             only the correct version of the code is used in the project.
                                             This should work always. It maps platform specifics to some #include statements or a checkout procedure. As a
                                             drawback, maintanance is more difficult because several versions of the same code coexist. This procedure can
                                             degenerate to independent versions of the same code if all code is compiler specific.
#ifndef _ANSI_CHECK_
                                                        #else
                                                        /* Use common declaration */
                                                        int i;
                                                        #endif
                                             4. Move compiler specific information to compiler command line. Compilers may allow to pass some proprietary
                                             information by code or command line. Latter is the best way to keep the code portable, but requires a defined
                                             procedure how to keep this information linked with code. For example, names of inline functions may be listed as
                                             compiler options, but these options must be archived in such a way that they can be restored easily from the CM
                                             system. So far, this method has not been used.
                                             /* SWMOD1c1.h: */
                                               #include "cdef.h"
                                               INLINE void f() { ....}
                                             Wrap keyword or keyword sequence by file inclusion.
                                             /* begin_inline.h : */
                                             #pragma begin inline
dissemination and/or editing of this document as well as utilization of its
                                             /* end_inline.h : */
inventions, are reserved by VDOTransmittal, reproduction,
                                             /* SWMOD1c1.h: */
                                             #include "begin_inline.h"
                                             void f()
model or design patent are reserved.
                                             {
                                               ...
                                             }
                                             #include "end_inline.h"
                                                                                                                              Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                   2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                          Status
                                                                                                                                                                                          released
                                                                                                     Documentkey                                                                          Pages
                                                                                                                                                                                          83 of 181
                                                   Siemens VDO Automotive AG                                                                            Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Note that this is the only way to enclose #pragma directives. Small helper files begin_inline.h and end_inline.h
                                             are as compiler specific as cdef.h. This practise has not been used so far.
                                             If proprietary keywords require additional parameters, it is unlikely to find a portable solution with 4 or 5. In
                                             general, try to restrict the usage of non-standard compiler features to low level driver code and use strategy 2 to
                                             provide some kind of hardware abstraction layer, so the problem is adressed more on the design level than the
                                             code level. Note that there is no general out-of-the-box solution to this kind of problem.
                                             Note: The _ANSI_CHECK_ define may not be confused with the _COMPILER_X86 define which is used to
                                             control the simulation under MSVC and therefore relates to functional control flow, whereas _ANSI_CHECK_
                                             encapsulates proprietary syntax e.g. to avoid warnings from the static code analysis or to allow compilation under
                                             MSVC for improved warning information.
                                             QAC-Rule: Logic
                                             3.2.1 Environment
                                             MISRA Rule 1: All code shall conform to ISO 9899 Standard C, with no extensions permitted.
                                             ISO 9899 standard C is enforced implicitly with Level 9 and Level 8 messages. These messages are not all
                                             individually registered against MISRA Rule 1. The messages which are explicitly registered against Rule 1 are all
                                             related to language extensions; they are visible at level 4 in the Message Personality but are generated as Level
                                             8 or 9. If it is necessary to use a particular language extension, it may be necessary to enable some of the
                                             language extension options in QAC and to suppress some of the warnings shown under this rule. Language
                                             extensions are permitted by the MISRA guidelines subject to raising appropriate documented deviations. Note
                                             that some other MISRA Rules trap particular violations of the ISO language standard explicitly. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
QAC-Rules: 0180, 0246, 0551, 0601, 0602, 1003, 1006, 1010, 1014, 1018 – 1022, 1026, 1027, 3664
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               84 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             For example:
                                                                    unsigned char uca = 0x1F;                                   /* Hex constant */
                                                                    unsigned char ucb = 0b00101110                            /* Binary constant - Message 246 */
                                                          0551                             Lang_ext           [E] Cast may not operate on the left operand of the assignment operator.
                                             It is illegal to attempt to cast the type of the type on the lhs. For example:
                                             int main(void)
                                             {
                                                int   c = 0;
                                                float ff = 20.0F;
                                                float gg = 5.0F;
(char)c = ff * gg;
                                                              return 0;
                                             }
                                                         0601                              Lang_ext         [E] 'main()' should have either type 'int (void)' or 'int (int, char *[])'.
                                             The ISO standard defines that the 'main' function will return an object of 'int' type and take either no arguments or
                                             two arguments with the types listed above. i.e. the two legal alternatives follow:
                                             int main(void) { /*...*/ }
                                             or
                                             int main(int argc, char* argv[]) { /*...*/ }
                                             where 'argc' and 'argv' could have any names. Alternatives to this are not guaranteed portable.
                                                          0602                            ISO_ExpU           [U] The identifier '%s' is reserved for use by the library.
                                             This identifier is a reserved identifier and should not be used here. e.g.
                                             int
                                             main (void)
                                             {
                                               int __sigDefault;                                       /*   warning 0602:        */
                                               int __sigIgnore;                                        /*   prefix '__' reserved */
                                               int __sigError;                                         /*   for library use      */
                                               int _sigIgnore;                                         /*   OK */
                                               return 1;
                                             }
                                             MOV DX, AX
                                             XOR AX, 0x7F
                                                                                                                                       Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                    Status
                                                                                                                                                                                                     released
                                                                                                      Documentkey                                                                                    Pages
                                                                                                                                                                                                     85 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    {
                                                                    /* ... */
                                                                        asm ("XOR DX, AX");                            /* asm keyword in function call */
                                                                    /* ... */
                                                                    }
                                                          1010                             Lang_ext          [E] Assuming '#%s' is extended '#if' preprocessor directive syntax.
                                             Assuming '#%s' is extended '#if' preprocessor directive syntax.
                                                          1014                             Lang_ext           [E] Unusual type specification - this will be treated as a language extension.
                                             This is not a recognised data type in ISO C90 although some compilers may allow it as an extended data type.
                                                          1020                             Lang_ext           [E] '__typeof__' is not a valid ISO C token, and is treated as an extension.
dissemination and/or editing of this document as well as utilization of its
                                             '__typeof__' is usually part of extended syntax, seen in Gnu compiler. This message warns that use of
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                               int test = 0;
                                               __typeof__(test) test1;                                        /* declaration of test1 as same type as test */
                                                          1021                             Lang_ext           [E] Statement in expression is not valid ISO, treated as an extension.
                                             Statements within expressions are not allowed in ISO C. The following will compile in Gnu compiler:
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  86 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          1022                             Lang_ext           [E] '__alignof__' is not a valid ISO C token, and is treated as an extension.
                                             '__alignof__' is usually part of extended syntax, seen in Gnu compiler. This message warns that use of
                                             '__alignof__' is non-portable. For example:
                                             static void foo(void)
                                             {
                                               int test = 0;
                                               test = __alignof__(char);                                            /* test receives byte alignment of char */
                                                        1026                              Lang_ext           [E] The indicated @word construct has been ignored.
                                             Some compilers use the @ character as a prefix to non-standard keywords that are C language extensions.
                                             These words can be parsed by QAC by defining them away using " _munch_at" syntax. Message 1026 is
                                             generated whenever a macro subsitiution of this form is generated. For example, by defining a macro
                                             "tiny=_munch_at", QAC could be configured to accept a declaration of the form:
                                             @tiny int x;                                 /* Message 1026 */
                                                          1027                             Lang_ext          [E] long long is a language extension.
                                             Type "long long" is not a valid integer type in the ISO 9899:1990 version of the C language and by default will be
                                             parsed and treated as a synonym for type "long". All declarations of type long long or unsigned long long will
                                             generate message 1027. "long long" is a valid type in the later ISO 9899:1999 language standard and QAC
                                             supports the extended type in accordance with that definition if the language extension option "-ex longlong" is
                                             enabled (Compiler Personality).
                                                          3664                             Lang_ext           [E] Using a dot operator to access an individual bit is a language extension.
                                             Some compilers support unorthodox data types which allow individual bits to be addressed using the symbol "."
                                             as a special operator. Such code can usually be parsed by redefining the data type to a standard integer type
                                             (using a configuration macro), but the bit selection operations will generate message 3664 For example:
                                             unsigned int a;
dissemination and/or editing of this document as well as utilization of its
                                             }
contents and communication there of to others without express
inventions, are reserved by VDOTransmittal, reproduction,
                                             MISRA Rule 5: Only those characters and escape sequences which are defined in the ISO C standard
model or design patent are reserved.
                                             shall be used.
                                             C source code which fully conforms to the ISO C standard should contain only the set of characters defined in the
                                             ISO standard. Use of any other characters may be supported by the implementation but will not necessarily be
                                             portable to other environments.
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  87 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             /* A non-conforming comment*/
                                             /* PRL¿°½¥º°ÄÞ¥Ú²±³Ä•W€ */                                              /* MISRA Violation */
                                             /* A non-conforming macro */
                                             #define MACA ABC$                                                        /* MISRA Violation */
                                                                                                                           Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                       Status
                                                                                                                                                                                       released
                                                                                                     Documentkey                                                                       Pages
                                                                                                                                                                                       88 of 181
                                                   Siemens VDO Automotive AG                                                                         Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                            Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                 2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                      Status
                                                                                                                                                                                        released
                                                                                                       Documentkey                                                                      Pages
                                                                                                                                                                                        89 of 181
                                                   Siemens VDO Automotive AG                                                                          Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                                           Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                     Status
                                                                                                                                                                                       released
                                                                                                       Documentkey                                                                     Pages
                                                                                                                                                                                       90 of 181
                                                   Siemens VDO Automotive AG                                                                         Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                         0285                             ISO_ImplDef                 [I] Character is not a member of the basic source character set.
                                             The C language standard specifies a minimum character set. The handling of any characters outside this basic
                                             set will amount to implementation defined behaviour. The basic set consists of the following characters:
                                             Letters:
                                                    A                                 B    C       D   E   F      G     H    I   J   K   L    M
                                                    N                                 O    P       Q   R   S      T     U    V   W   X   Y    Z
                                                    a                                 b    c       d   e   f      g     h    i   j   k   l    m
                                                    n                                 o    p       q   r   s      t     u    v   w   x   y    z
                                             Decimal digits
                                                    0 1 2                                          3   4   5      6     7    8   9
dissemination and/or editing of this document as well as utilization of its
                                             Graphic characters
the property of VDO. This document and ll information is confidential.
                                                    ; < = > ?                                              [      \     ]    ^   _   {   |    }    ~
inventions, are reserved by VDOTransmittal, reproduction,
                                             Others
                                                                                   Space character
                                                                                   Horizontal tab
                                                                                   Vertical tab
                                                                                   Form feed
model or design patent are reserved.
                                                          0286                            ISO_ImplDef                  [I] String literal contains character which is not a member of the basic source
                                                                                                                       character set.
                                                                                                                                                   Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                        2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                               Designation                                                                                        Status
                                                                                                                                                                                                                  released
                                                                                                               Documentkey                                                                                        Pages
                                                                                                                                                                                                                  91 of 181
                                                   Siemens VDO Automotive AG                                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The C language standard specifies a minimum character set. The handling of any characters outside this basic
                                             set will amount to implementation defined behaviour. The basic set consists of the following characters:
                                             Letters:
                                                    A                                 B   C   D   E   F      G    H     I   J   K   L   M
                                                    N                                 O   P   Q   R   S      T    U     V   W   X   Y   Z
                                                    a                                 b   c   d   e   f      g    h     i   j   k   l   m
                                                    n                                 o   p   q   r   s      t    u     v   w   x   y   z
                                             Decimal digits
                                                    0 1 2                                     3   4   5      6    7     8   9
                                             Graphic characters
                                                    ! " # % &                                         '      (    )     *   +   ,   -   .   /      :
                                                    ; < = > ?                                         [      \    ]     ^   _   {   |   }   ~
                                             Others
                                                                                   Space character
                                                                                   Horizontal tab
                                                                                   Vertical tab
                                                                                   Form feed
                                                          0287                            ISO_ImplDef             [I] Header name contains character which is not a member of the basic source
                                                                                                                  character set.
                                             The C language standard specifies a minimum character set. The handling of any characters outside this basic
                                             set will amount to implementation defined behaviour. The basic set consists of the following characters:
                                             Letters:
                                                    A                                 B   C   D   E   F      G    H     I   J   K   L   M
                                                    N                                 O   P   Q   R   S      T    U     V   W   X   Y   Z
                                                    a                                 b   c   d   e   f      g    h     i   j   k   l   m
                                                    n                                 o   p   q   r   s      t    u     v   w   x   y   z
                                             Decimal digits
                                                    0 1 2                                     3   4   5      6    7     8   9
                                             Graphic characters
                                                    ! " # % &                                         '      (    )     *   +   ,   -   .   /      :
                                                    ; < = > ?                                         [      \    ]     ^   _   {   |   }   ~
                                             Others
                                                                                   Space character
                                                                                   Horizontal tab
                                                                                   Vertical tab
                                                                                   Form feed
dissemination and/or editing of this document as well as utilization of its
                                                          0288                            ISO_ImplDef             [I] Source file '%s' has comments containing characters which are not
contents and communication there of to others without express
                                             The C language standard specifies a minimum character set. The handling of any characters outside this basic
                                             set will amount to implementation defined behaviour. The basic set consists of the following characters:
                                             Letters:
model or design patent are reserved.
                                                    A                                 B   C   D   E   F      G    H     I   J   K   L   M
                                                    N                                 O   P   Q   R   S      T    U     V   W   X   Y   Z
                                                    a                                 b   c   d   e   f      g    h     i   j   k   l   m
                                                    n                                 o   p   q   r   s      t    u     v   w   x   y   z
                                                                                                                                            Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                 2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                          Designation                                                                                   Status
                                                                                                                                                                                                        released
                                                                                                          Documentkey                                                                                   Pages
                                                                                                                                                                                                        92 of 181
                                                   Siemens VDO Automotive AG                                                                                          Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Decimal digits
                                                    0 1 2                                     3   4    5      6    7     8   9
                                             Graphic characters
                                                    ! " # % &                                          '      (    )     *   +   ,   -   .   /      :
                                                    ; < = > ?                                          [      \    ]     ^   _   {   |   }   ~
                                             Others
                                                                                   Space character
                                                                                   Horizontal tab
                                                                                   Vertical tab
                                                                                   Form feed
                                                          0289                            ISO_ImplDef              [I] Source file '%s' has preprocessing tokens containing characters which are
                                                                                                                   not members of the basic source character set.
                                             The C language standard specifies a minimum character set. The handling of any characters outside this basic
                                             set will amount to implementation defined behaviour. The basic set consists of the following characters:
                                             Letters:
                                                    A                                 B   C   D   E    F      G    H     I   J   K   L   M
                                                    N                                 O   P   Q   R    S      T    U     V   W   X   Y   Z
                                                    a                                 b   c   d   e    f      g    h     i   j   k   l   m
                                                    n                                 o   p   q   r    s      t    u     v   w   x   y   z
                                             Decimal digits
                                                    0 1 2                                     3   4    5      6    7     8   9
                                             Graphic characters
                                                    ! " # % &                                          '      (    )     *   +   ,   -   .   /      :
                                                    ; < = > ?                                          [      \    ]     ^   _   {   |   }   ~
                                             Others
                                                                                   Space character
                                                                                   Horizontal tab
                                                                                   Vertical tab
                                                                                   Form feed
                                             3.2.3 Comments
                                             MISRA Rule 9: Comments shall not be nested.
                                             Message 3108 will identify an occurrence of the sequence "/*" within a comment but nested comments are not a
                                             supported feature of the ISO C language and any attempt to code in this way will almost certainly precipitate
                                             syntax errors. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             {
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                 /* A /* MISRA */ Violation */
This document and the information ..............................................
                                                                    return;
inventions, are reserved by VDOTransmittal, reproduction,
                                             }
                                             QAC Rule: 3108
                                                          3108                                Syntax               [S] Nested comments are not recognised in the ISO standard and should not be
                                                                                                                   used.
model or design patent are reserved.
                                             Nested comments are not a feature of ISO C. Some compilers will accept them, others will not. QAC does not
                                             parse nested comments and generates message 3106 whenever it encounters the characters /* within a
                                             comment. This is not in itself indicative of a syntax error but other syntax error warnings will probably follow if the
                                             outer comment is terminated prematurely. For example:
                                                                                                                                             Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                                  2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                           Designation                                                                                   Status
                                                                                                                                                                                                         released
                                                                                                           Documentkey                                                                                   Pages
                                                                                                                                                                                                         93 of 181
                                                   Siemens VDO Automotive AG                                                                                           Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                     /*
                                                                                    j=1; /* nested comment - message 3106 */
                                                                                    */
                                             3.2.4 Identifiers
                                             MISRA Rule 11: Identifiers (internal and external) shall not rely on significance of more than 31
                                             characters. Furthermore the compiler/linker shall be checked to ensure that 31 character significance and
                                             case sensitivity are supported for external identifiers.
                                             This rule is actually a relaxation of the requirements of ISO C.which states that external identifiers should be
                                             distinct within 6 characters if the program is to be described as fully conforming and therefore portable. Example
                                             Code:
                                             #pragma PRQA_MESSAGES_OFF 3408 /* identifier is externally visible */
#include "misra.h"
                                                                                   r = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1 +
                                                                                       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2 +
                                                                                       cccccccccccccccccccccccccccccc1 +
                                                                                       cccccccccccccccccccccccccccccc2 +
                                                                                       ddddddddddddddddddddddddddddddd1 +
                                                                                       ddddddddddddddddddddddddddddddd2;
                                                                                   return(r);
dissemination and/or editing of this document as well as utilization of its
                                             }
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                          0777                            ISO_ExpU           [U] External identifier does not differ from other identifier(s) (e.g. '%s') within
                                                                                                             the specified number of significant characters.
                                             The ISO standard specifies that all external identifiers must be unique within the first 6 characters. Message 776
                                             will be generated if this limit is breached.
model or design patent are reserved.
                                             Many development environments require more flexibility than this, and this message when external identifiers are
                                             not distinct within a specified number of characters. This limit may be specified to QAC with the configuration
                                             option -xnamelength (which may be applied through the compiler personality under GUI usage). A violation of this
                                             limit will cause message 777 to be generated.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                   Status
                                                                                                                                                                                                   released
                                                                                                     Documentkey                                                                                   Pages
                                                                                                                                                                                                   94 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          0779                            ISO_ExpU           [U] Identifier does not differ from other identifier(s) (e.g. '%s') within the
                                                                                                             specified number of significant characters.
                                             The ISO standard specifies that all identifiers must be unique within the first 31 characters. Message 778 will be
                                             generated if this limit is breached.
                                             Many development environments require more flexibility than this, and this message is generated when internal
                                             identifiers are not distinct within a specified number of characters. This limit may be specified to QAC with the
                                             configuration option -namelength (which may be applied through the compiler personality under GUI usage). A
                                             violation of this limit will cause message 779 to be generated.
                                             3.2.5 Types
                                             MISRA Rule 14: The type char shall always be declared as unsigned char or signed char.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    return(0);
                                             }
                                             QAC-Rule 3625
                                                       3625                              Min_Decl       The type char should be declared explicitly as unsigned or signed char.
                                             An object declared as plain char may be implemented as either a signed or an unsigned quantity. It is good
                                             practice to be specific so as to reduce portability problems.
                                             3.2.6 Constants
                                             MISRA Rule 19: Octal constants (other than zero) shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
dissemination and/or editing of this document as well as utilization of its
                                             {
This document and the information ..............................................
                                                 S32 i;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 S32 j;
                                                 S32 k;
                                                 PC buf[] = "ABC\15";                                                    /* MISRA Violation */
                                                                    i = 0xFF;                                            /* Hex is OK */
                                                                    j = 052;                                             /* MISRA Violation */
model or design patent are reserved.
return(i+j+k);
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                   Status
                                                                                                                                                                                                   released
                                                                                                     Documentkey                                                                                   Pages
                                                                                                                                                                                                   95 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3628                            Min_Const           Octal escape sequences shall not be used in character constants or string
                                                                                                              literals.
                                             Octal escape sequences shall not be used in character constants or string literals.
                                             3.2.7 Declaration and Definition, Misra-Rules: 20, 21, 24, 25, 26, 29*
                                             *= Supported with specified limitation for DAC.
                                             MISRA Rule 20: All object and function identifiers shall be declared before use
                                             A reference to an object which has not been declared is a language constraint error, and is therefore
                                             automatically identifed as a MISRA violation under Rule 1. A reference to a function which has not been declared
                                             is permissible in the C language.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                             extern S32 test_020( void )
                                             {
                                                 S32 r;
                                                 r = testf();               /* MISRA Violation */
                                                 a020 = 0;                  /* Constraint Error - MISRA Rule 1 Violation */
                                                 return(r);
                                             }
                                             QAC-Rule 3335
                                                      3335                              Maj_Func       No function prototype. Implicit declaration inserted: 'extern int %s();'.
                                             A function is being used for which there is no previous definition or prototype, and so in accordance with the ISO
                                             standard an implicit declaration is being inserted. However it is not good practice to use functions without
                                             providing a function prototype to define the interface.
dissemination and/or editing of this document as well as utilization of its
                                             MISRA Rule 21: Identifiers in an inner scope shall not use the same name as an identifier in an outer
inventions, are reserved by VDOTransmittal, reproduction,
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
model or design patent are reserved.
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 96 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    S16 b;
                                             };
                                                                    }
                                                                    return (ret);
                                             }
                                             }
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             For example:
                                             struct sT
                                             {
                                                 /* ... */
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 97 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             };
                                             /* ... */
                                             void func(void)
                                             {
                                                 union sT t;                                     /* Hides struct sT */
                                                 /* ... */
                                             }
                                             Check that your are picking up the right structure or union definition.
                                             MISRA Rule 24: Identifiers shall not simultaneously have both internal and external linkage in the same
                                             translation unit.
                                             /*
                                             Note that the rules by which linkage are defined were modified in
                                             Technical Corrigendum 1 of the ISO C standard,
*/
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                98 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             static S32 test_024( void )                                            /* Internal linkage (1) ***** MISRA Violation *****/
                                             {
                                                 extern S32 a024;                                                   /* External linkage (3) */
                                                 static S32 a024 = 0;                                               /* Internal linkage (1) ***** MISRA Violation *****/
                                                                    return(1);
                                             }
                                             QAC-Rule 0625
                                                          0625                             ISO_ExpU           [U] '%s' has been declared with both internal and external linkage - the
                                                                                                              behaviour is undefined.
                                             The variable has been declared at least twice with one of the declarations involving the static storage-class
                                             qualifier. e.g.
                                             int number;
                                             static int number;
                                             'number' is implicitly declared external through the first declaration and explicitly static through the second
                                             declaration. Try and resolve this variable's linkage.
                                             linkage - an identifier can have one of three types of linkage - external (defined outside this translation unit),
                                             internal (defined for use within a particular translation unit) and none (denoting unique entities).
dissemination and/or editing of this document as well as utilization of its
                                             MISRA Rule 25: An identifier with external linkage shall have exactly one external definition.
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             This rule is enforced within a single translation unit by normal QAC analysis. It may be enforced within a project
prior written consent of VDO. All rigths, especially with regard to
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                             S32 obj_025a = 3;
model or design patent are reserved.
S32 obj_025b = 1;
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 99 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          0630                            ISO_ExpU          [U] More than one definition of '%s' (with external linkage).
                                             A global object or function has been defined more than once in this file. It is legitimate to have multiple
                                             declarations of the same identifier, but there should only ever be one definition.
                                             For example:
                                             int number=0;
                                             /* ... */
                                             int number=1;
5025 MISRA_Rule_25_Req_ An identifier with external linkage shall have exactly one external definition.
                                             MISRA Rule 26: If objects or functions are declared more than once they shall have compatible
                                             declarations.
                                             At a single file level, QAC enforces this rule through Rule 72
                                             To apply complete coverage of this rule, it is necessary to run the MCM Global Checks report on your project.
                                             This will check for violations of Rule 26 project-wide. The global test will check that all declarations and definitions
                                             of functions or variables with external linkage have the same type.
                                             Note: The global test will not pick up static variables. These will be picked up by QAC messages.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                             static S32 i;
                                             static F32 i;                                                           /* MISRA Violation */
extern S8 buf[10];
                                                          0626                            ISO_ImpU           [u] '%s' has different type to previous declaration (which is no longer in scope).
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             Two declarations for the same global identifier are in conflict. The declarations occur in different scopes but are
inventions, are reserved by VDOTransmittal, reproduction,
                                             }
                                             void foo2(void)
                                             {
                                                 extern long glob;
                                                                                                                                        Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                    Status
                                                                                                                                                                                                    released
                                                                                                     Documentkey                                                                                    Pages
                                                                                                                                                                                                    100 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /* ... */
                                             }
                                                          0627                             Constraint           [C] '%s' has different type to previous declaration in the same scope.
                                             Two declarations of the same identifier are in conflict. Both declarations have been made at the same scope.
                                             Note that it is possible and legitimate (although unwise) to hide an identifier with a different declaration at an inner
                                             scope. For example:
                                                              int figure;
                                                              /* ... */
                                                              /* ... */
                                                              long figure;
                                                          0628                             Constraint          [C] '%s' has different type to previous in-scope declaration.
                                             This has a different type to a previous declaration of the same variable. Although it is legal in C to redeclare a
                                             variable, the type has to be the same. It is illegal to redeclare with a different type in the same scope. For
                                             example:
                                             int foo(void);
                                             int i;
                                             char c;
                                             long i;                                               /* different type to previous decl */
                                             char foo(void);                                       /* different type to previous decl */
                                             int main(void)
                                             {
                                                extern char i;                                     /* different type to previous in-scope decl */
                                                int x;
                                                char cc = 1;
                                                              i = 0;
                                                              c = 'a';
                                                              boo();                               /* function undeclared */
                                                              if (cc) {
                                                                 long x = 1L;                      /* hides a more global decl */
                                                                 x++;
                                                              }
                                                              return (int)i;
                                             }
                                             }
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                                return;
                                             }
                                             Change the name of the redeclared items or simply remove the redeclared items if the declaration is redundant.
                                             Also do not declare a variable that hides a another object of the same name. Not only is this very confusing and
                                             prone to misuse, some tools handle variable visibility differently especially when leaving inner scope blocks.
model or design patent are reserved.
                                                   5026                             MISRA_Rule_26_Req_                If objects or functions are declared more than once they shall have
                                                                                                                      compatible declarations.
                                                                                                                                          Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                               2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                   Status
                                                                                                                                                                                                      released
                                                                                                        Documentkey                                                                                   Pages
                                                                                                                                                                                                      101 of 181
                                                   Siemens VDO Automotive AG                                                                                        Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 29: The use of a tag shall agree with its declaration.
                                             The use of a tag must agree with its declaration. In the example below, a struct is defined with the tag "record"
                                             and it is subsequentially reused in the definition of a union. This is illegal in ISO C. For example:
                                             struct record
                                             {
                                                 int     number;
                                             };
/* ... */
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                             struct mytaga
                                             {
                                                 S32 i;
                                                 S32 j;
                                                 S32 k;
                                             } ;
                                             struct mytagb
                                             {
                                                 S32 i;
                                                 S32 j;
                                                 S32 k;
                                             } ;
                                             struct mytagc
                                             {
                                                 S32 i;
                                                 S32 j;
                                                 S32 k;
                                             } ;
                                             }
contents and communication there of to others without express
                                             QAC-Rule: 0547
inventions, are reserved by VDOTransmittal, reproduction,
                                                          0547                            ISO_ExpU          [U] This declaration of tag '%s' conflicts with a previous declaration.
                                             The specified tag declaration conflicts with a previous declaration. For example the same tag identifier cannot be
                                             used to define both a structure and a union. There is one namespace for all structure, union and enum tags.
                                             For example:
model or design patent are reserved.
                                             struct record
                                             {
                                                 int number;
                                             };
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                 Status
                                                                                                                                                                                                 released
                                                                                                     Documentkey                                                                                 Pages
                                                                                                                                                                                                 102 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             3.2.8 Initialization
                                             MISRA Rule 32: In an enumerator list, the '=' construct shall not be used to explicitly initialise members
                                             other than the first, unless all items are explicitly initialised.
                                             The MISRA rule permits three ways of initialising the members of an enum list:
                                             1. None are initialised.
                                             2. Only the first is initialised.
                                             3. All are initialised.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                    return(0);
                                             }
                                             QAC-Rule 0723
                                                   0723                             Min_Enum    Initialise none, first only, or all entries in this enumerator list.
                                             Different coding standards make a variety of demands on the way in which enum constants may be initialised. This message
                                             suggests that either first enum, all enums, or none of the enums should be explicitly initialised. For example:
                                             enum colours
                                             {
                                                   red,
                                                   green = 4,
                                                   blue = 5
                                             } col;        /* prohibited: first enum not initialised */
                                             enum colours
dissemination and/or editing of this document as well as utilization of its
                                             {
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                 red = 1,
This document and the information ..............................................
                                                 green = 4,
contents and communication there of to others without express
                                                 blue = 5
inventions, are reserved by VDOTransmittal, reproduction,
                                             enum colours
                                             {
                                                 red = 3,
model or design patent are reserved.
                                                 green,
                                                 blue
                                             } col;     /* OK: only first enum is initialised */
                                                                                                                                          Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                               2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                        Status
                                                                                                                                                                                                          released
                                                                                                       Documentkey                                                                                        Pages
                                                                                                                                                                                                          103 of 181
                                                   Siemens VDO Automotive AG                                                                                            Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 33*: The right hand operand of a && or || operator shall not contain side effects.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                    return r;
                                             }
                                             QAC-Rule 3415
                                                           3415                           Maj_SideEff          The right hand operand of '&&' or '||' has side effects.
                                             The right hand operand of the && operator is only evaluated if the left hand operand evaluates to "true". The right hand
                                             operand of the || operator is only evaluated if the left hand operand evaluates to "false". In either case, it can be confusing if
                                             side effects are conditional on the left hand operand. It may be better practice to use an explicit test to control this behaviour.
                                             For example:
                                             /* ... */
                                             if ((w==y) && ((x=fn())==z))
                                             /* ... */
                                             x is only assigned the return value of 'func' if 'w==y' evaluates to true.
                                             MISRA Rule 34: The operands of a logical && or || shall be primary expressions.
                                             Rule 47 partially enforces this rule.
                                             Example Code:
dissemination and/or editing of this document as well as utilization of its
                                             #include "misra.h"
inventions, are reserved by VDOTransmittal, reproduction,
                                             extern S16 test_034( S16 x, S16 y, S16 z, S16 ishigh, const S16 *pr)
                                             {
                                                 S16 r = 0;
                                                                                                                                          Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                               2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                     Status
                                                                                                                                                                                                        released
                                                                                                        Documentkey                                                                                     Pages
                                                                                                                                                                                                        104 of 181
                                                   Siemens VDO Automotive AG                                                                                          Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
r = x && y && z;
                                                                    return(r);
                                             }
                                             QAC-Rule 3400
                                                        3400                             Min_Stmt       The operands of a logical && or || operator shall be primary expressions
                                             An operand of a && and || operator, should always be logical expression or an object expressing a Boolean
                                             value. The C language does not recognise a Boolean type but a number of operators return a Boolean value
                                             expressed as an integer. In order to avoid confusion, it is safer if the operands of && and || operators are primary
                                             expressions, i.e. an identifier, a literal constant or a parenthesised expression. For example:
                                                           r = a && b && c;                                                /*   OK */
                                                           r = a || b || c;                                                /*   OK */
                                                           r = (a > 200) && c;                                             /*   OK */
                                                           r = a && b || c;                                                /*   Message   3400   */
                                                           r = a || b && c;                                                /*   Message   3400   */
                                                           r = a > 200 && c;                                               /*   Message   3400   */
                                                           r = !a && b;                                                    /*   Message   3400   */
                                                           r = !a || b;                                                    /*   Message   3400   */
                                                           r = *pi || b;                                                   /*   Message   3400   */
                                                           r = a || !b;                                                    /*   Message   3400   */
                                                        r = a || *pi;       /* Message 3400 */
MISRA Rule 35: Assignment operators shall not be used in expressions which return Boolean values.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                    if ( x = i )                                   /* MISRA Violation */
                                                                    {
                                                                        r = 1;
                                                                    }
dissemination and/or editing of this document as well as utilization of its
                                                                    if ( (x = i) != 0 )                            /* MISRA Violation */
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                                    {
This document and the information ..............................................
                                                                        r = 1;
                                                                    }
inventions, are reserved by VDOTransmittal, reproduction,
                                                                    return(r);
                                             }
                                                                                                                                   Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                Status
                                                                                                                                                                                                released
                                                                                                     Documentkey                                                                                Pages
                                                                                                                                                                                                105 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             QAC-Rule 3326
                                                         3326                              Min_Stmt           Assignment operators shall not be used in boolean expressions.
                                             The C language does not include a Boolean type but a number of operators return a boolean value (0/1) and
                                             various control expressions use an arithmetic value in a boolean sense. These are the types of expression which
                                             QAC classes as boolean. Message 3326 is generated if any assignment (=) or compound assignment (+=, -=
                                             etc.) operator is present in such an expression. For example:
                                             if (fp = fopen("filename", "r")) != NULL)                     /* Message 3326 */
                                             ...
                                             if (i += j) ++r;                               /* Message 3326 */
                                             MISRA Rule 36: Logical operators should not be confused with bitwise operators.
                                             QAC can flag variations of possible misuse of logical and bitwise (arithmetic) operators.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                          4101                             Maj_Ops             Both operands of & bitwise AND operator are "boolean" expressions.
dissemination and/or editing of this document as well as utilization of its
                                             Two expressions of "boolean" type are the operands of a & bitwise AND operator . This is probably a mistake; the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             For example:
inventions, are reserved by VDOTransmittal, reproduction,
                                             For example:
                                                  x = (a > b) | (c > d);              /* Message 4102 */
                                                                                                                                     Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   106 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4106                             Maj_Ops           Both operands of && logical AND operator are "arithmetic" expressions.
                                             Two expressions of arithmetic type are the operands of a && logical AND operator. This is probably a mistake;
                                             the bitwise AND operator, & was probably intended.
                                             For example:
                                                                    x = (a + b) && (c + d);                        /* Message 4106 */
                                             MISRA Rule 37: Bitwise operations shall not be performed on signed integer types.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                    y          =    y << 2;
                                                                    y          =    y >> 1;
inventions, are reserved by VDOTransmittal, reproduction,
                                                                    y          =    y & 3;
                                                                    y          =    y | 5;
                                                                    y          =    ~y;
                                                                    return(x);
model or design patent are reserved.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                Status
                                                                                                                                                                                                released
                                                                                                     Documentkey                                                                                Pages
                                                                                                                                                                                                107 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                         0502                              Min_Ops           A right shift on signed data may be an arithmetic or a logical shift.
                                             Right shift operations on signed operands are implementation defined. In a logical shift, the left hand bits are
                                             replaced with zeroes; in an arithmetic shift the left hand bits are replaced by replicating the sign bit. In addition the
                                             format of negative integers is not defined by the ISO standard (although in practice it is usually a two's
                                             complement format).
                                             A special situation arises when unsigned char and unsigned short objects are the operands of a shift operator.
                                             The rules of integer promotion require that these objects are usually promoted to signed int before the shift, and
                                             so internally the operation is performed on a signed data type even though the underlying data is unsigned. QAC
                                             does not generate message 502 when the immediate operand is unsigned but there are some more complex
                                             unsigned expressions in which the message is generated as an indirect result of integral promotion.
                                             Note that the shifting right of a negative twos-complement integer may not produce the same result as a division
                                             by two. The result of dividing the value -5 by 2 can be implemented as -2 remainder -1, or as -3 remainder 1. An
                                             arithmetic right shift will aways yield the value -2.
                                             For example:
                                                                    /* ... */
                                                                    int   sia;
                                                                    unsigned char uca;
                                                          4130                             Maj_Ops            Bitwise operations on signed data will give implementation defined results.
                                             It is not usually appropriate to perform bitwise operations (e.g. |, &, ^ , ~) on signed data types. The internal
                                             representation of negative integer numbers is not defined (although it is usually two's complement), and therefore
                                             it is not wise and not portable to manipulate "signed" data with bitwise operators.
                                             A special situation arises when unsigned char and unsigned short objects are the operands of a bitwise operator.
                                             The rules of integer promotion require that these objects are usually promoted to signed int before the bitwise
                                             operation, and so internally the operation is performed on a signed data type even though the underlying data is
                                             unsigned. QAC does not generate message 4130 when the immediate operand is unsigned but there are some
                                             more complex unsigned expressions in which the message is generated as an indirect result of integral
                                             promotion.
                                             For example:
                                             void func (
                                                 int sia,
                                                 unsigned char uca,
                                                 unsigned char ucb
                                             )
                                             {
                                                 /* ... */
                                                 sia = sia & 0x7F7F;                                             /* Message 4130 */
                                                 sia = uca | ucb;                                             /* No message */
dissemination and/or editing of this document as well as utilization of its
                                             }
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             It is not good practice to use shift operations on signed data. The internal representation of negative integer
                                             numbers is not defined (although it is usually two's complement), and therefore it is not wise and not portable to
                                             manipulate "signed" data with shift operators.
                                             A special situation arises when unsigned char and unsigned short objects are the operands of a shift operator.
                                             The rules of integer promotion require that these objects are usually promoted to signed int before the shift, and
model or design patent are reserved.
                                             so internally the operation is performed on a signed data type even though the underlying data is unsigned. QAC
                                             does not generate message 4131 when the immediate operand is unsigned but there are some more complex
                                             unsigned expressions in which the message is generated as an indirect result of integral promotion.
                                             e.g.
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  108 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             void func (
                                                                    int sia,
                                                                    unsigned char uca,
                                             )
                                             {
                                                                    ...
                                                                    sia = sia << 3;                         /* Message 4131 */
                                                                    sia = uca << 2;                         /* No message */
                                             MISRA Rule 42: The comma operator shall not be used, except in the control expression of a for loop.
                                             This rule doesn't prevent the use of the comma operator in a for loop; however if the comma operator is used in a
                                             for loop, it is likely to violate Rule 66 Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                             #define A (-5)
                                             #define B 3
y = ( x = A, x + B ); /* MISRA Violation */
                                                                    return(y);
                                             }
                                             QAC-Rules 3417
                                                          3417                             Min_Ops            The comma operator should be avoided. It is better practice to use separate
                                                                                                              statements.
                                             Don't use the comma operator simply to avoid creating two statements. The comma operator makes code less
dissemination and/or editing of this document as well as utilization of its
                                             The comma operator is most frequently used in for loop headers. Message 3417 is not generated in the for loop
contents and communication there of to others without express
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                109 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             3.2.10 Conversions
                                             MISRA Rule 45: Type casting from any type to or from pointers shall not be used.
                                             Implicit conversions between pointers are not permitted in the C language and any attempt to do such a
                                             conversion constitutes a language constraint error (Rule 1). This MISRA rule is concerned with disallowing casts
                                             which involve pointers. Casts between function pointer types are included in the scope of this rule but are
                                             specifically addressed by Rule 105.
                                             A fundamental danger with pointer casts is attempting to cast a pointer to a type which has a stricter alignment
                                             requirement. This might occur when casting a char * to an int * if the char * pointer may reside on any byte
                                             boundary, but an int * is constrained to alignment on a 4 byte boundary. Casting from an int * to a char *,
                                             however, would be safe.
                                             If the requirements of this rule are to be relaxed in any way, it may be sensible to disable QAC message number
                                             310. The configuration will then still warn against casts between, for example, integers and pointers but will
                                             permit casts between different pointer types providing they are "safe" under the conditions described above. If
                                             you wish to modify the configuration in this way, It is particularly important that QAC is configured to specify the
                                             correct alignment restrictions and size of all datatypes. Example Code:
                                             /***********************************************************
                                                              | Integer |Object Pointer|Function Pointer|
                                             -----------------|---------|--------------|----------------|
                                             Integer          |   nnn   |     306      |      306       |
                                             Object Pointer   |   306   |     310      |      307       |
                                             Function Pointer |   306   |     307      |    * 313 *     |
                                             -----------------|---------|--------------|----------------|
                                             ***********************************************************/
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
struct X;
                                                                                                                          Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com               2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                    Status
                                                                                                                                                                                      released
                                                                                                       Documentkey                                                                    Pages
                                                                                                                                                                                      110 of 181
                                                   Siemens VDO Automotive AG                                                                        Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    return(0);
                                             }
                                                          0306                           ISO_ImplDef         [I] Cast between pointer and integral type is implementation defined.
                                             It is dangerous to cast to and from integers as the implementation defines the size of the integer required and the
                                             result of the cast. This could result in a loss of information. The exception is the casting of integer value zero
                                             which will produce a NULL pointer.
                                             p = (struct x*)&i;
                                             attempts to take the address of 'i' and convert it to an address of an incomplete type.
                                             incomplete type - any type which describes an object for which information required to determine its
                                             size is missing.
                                                int * pi;
the property of VDO. This document and ll information is confidential.
                                                char * pc;
This document and the information ..............................................
                                             provided that no attempt is made to execute the function between casts (as the function return type would
                                             obviously disagree with the intermediate pointer type and therefore lead to undefined behaviour).
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                  Status
                                                                                                                                                                                                  released
                                                                                                     Documentkey                                                                                  Pages
                                                                                                                                                                                                  111 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             /* ... */
damages. All rights created by patent grant or registration of a utility
                                             pc = (char *)pl;        /* OK */
inventions, are reserved by VDOTransmittal, reproduction,
/* ... */
                                             MISRA Rule 46: The value of any expression shall be independent of the order of its evaluation.
model or design patent are reserved.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                 Status
                                                                                                                                                                                                 released
                                                                                                     Documentkey                                                                                 Pages
                                                                                                                                                                                                 112 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /***********************************************************************/
                                                                    /* 0401 '%s' may be modified more than once between sequence points    */
                                                                    /*      - evaluation order undefined.                                  */
                                                                    /***********************************************************************/
                                                                    /* In this case the order of the increment and assignment ARE NOT defined */
                                                                    x = (x > max) ? (++x) : 0;          /* MISRA Violation */
                                                                    /* In this case the order of the increment and assignment ARE NOT defined */
                                                                    x = (y > max) ? (++x) : 0;          /* MISRA Violation */
y = test_046c(&x) + (x++); /* OK */
                                                                    /***********************************************************************/
model or design patent are reserved.
                                                                                                                           Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                       Status
                                                                                                                                                                                       released
                                                                                                     Documentkey                                                                       Pages
                                                                                                                                                                                       113 of 181
                                                   Siemens VDO Automotive AG                                                                         Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /***********************************************************************/
                                                                    /* 0403 '%s' may be modified and accessed between sequence points      */
                                                                    /*      - evaluation order undefined.                                  */
                                                                    /***********************************************************************/
                                                                    y = test_046a(&x) + x;              /* MISRA Violation   */
                                                                    y = buf[x] + test_046a(&x);         /* MISRA Violation   */
                                                          0400                            ISO_ExpU           [U] '%s' is modified more than once between sequence points - evaluation
                                                                                                             order undefined.
                                             An object is being modified more than once between sequence points. The ISO standard indicates that the
                                             evaluation order in this case is undefined; i.e. you cannot guarantee that one object modification happens before
                                             another - only that all modifications will be complete at the next sequence point. For example:
                                                                    x = 2;
                                                                    y = 3;
                                                          0401                            ISO_ExpU           [U] '%s' may be modified more than once between sequence points -
                                                                                                             evaluation order undefined.
                                             There is a possibility (although not certainty) in this statement that an object may be modified more than once
                                             between sequence points. The ISO standard indicates that the evaluation order in this case is undefined; i.e. you
                                             cannot guarantee that one object modification happens before another - only that all modifications will be
                                             complete at the next sequence point. For example:
                                                                    x = func(&x);                                          /* Message 0401 */
                                                                    i = ((x==0) ? ++i : i);                                /* Message 0401 & 3415 */
dissemination and/or editing of this document as well as utilization of its
                                                          0402                            ISO_ExpU           [U] '%s' is modified and accessed between sequence points - evaluation order
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                                                                             undefined.
This document and the information ..............................................
                                             An object is being used and also modified between sequence points. The ISO standard indicates the evaluation
inventions, are reserved by VDOTransmittal, reproduction,
                                             order in this case to be undefined. i.e. you cannot guarantee if the modification will take place before or after it is
                                             used. For example:
                                             if (a[++index] == a[index])
                                             In the above example you might consider the order of evaluation to be as it reads from left to right. This would
                                             lead you to believe that this the condition would always evaluate to TRUE. However, if evaluation order was from
model or design patent are reserved.
                                             right to left then no such assumption can be made. Two ISO certified compilers could conceivably generate
                                             different results in this case.
0403 ISO_ExpU [U] '%s' may be modified and accessed between sequence points - evaluation
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               114 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                                                             order undefined.
                                             The variable may have its value both used and updated between sequence points. It is not certain that this will
                                             occur, perhaps because it depends on some conditionally-executed code. Because the order of evaluation of
                                             expressions between sequence points is unspecified, it is impossible to know if the variable will be modified
                                             before or after is has been used. For example:
                                             if (a[val==0 ? ++index : index] == a[index])
                                             The variable 'index' may or may not be modified depending upon the value of the 'val' variable. If it is modified,
                                             the value of the right hand side of the expression may be evaluated before or after 'index' is modified.
                                             Reliance on the order of evaluation in such cases is very dangerous and non-portable.
                                             MISRA Rule 49: Tests of a value against zero should be made explicit, unless the operand is effectively
                                             Boolean.
                                             QAC issues a warning when the test expression in a control statement does not include at top level an operator
                                             which provides a "Boolean" result, e.g. for:
                                             if (x)
                                             but not for:
                                             if (!x)
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
                                                                    if ( i )                     /* MISRA Violation */
                                                                    {
                                                                        r = 1;
                                                                    }
j = i ? 2 : 3; /* MISRA Violation */
                                                                    if ( i + j )                 /* MISRA Violation */
                                                                    {
                                                                        r = 2;
                                                                    }
                                                                    if ( !i )                    /* OK */
                                                                    {
                                                                        r = 3;
dissemination and/or editing of this document as well as utilization of its
                                                                    }
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                 if ( i > j )                                    /* OK */
contents and communication there of to others without express
                                                 {
inventions, are reserved by VDOTransmittal, reproduction,
                                             #if 1
                                                     r = 4;
                                             #endif
                                                 }
model or design patent are reserved.
                                                                    if ( i = 1 )                 /* MISRA Violation */
                                                                    {
                                                                      r = 5;
                                                                    }
                                                                                                                                Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                     2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                            Status
                                                                                                                                                                                            released
                                                                                                     Documentkey                                                                            Pages
                                                                                                                                                                                            115 of 181
                                                   Siemens VDO Automotive AG                                                                              Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    return(r);
                                             }
QAC-Rule 3344
                                             if               ((a + b)==0) /* OK */
                                             if               (a > b) /* OK */
                                             if               (a == b) /* OK */
                                             if               (b != 0) /* OK */
MISRA Rule 50: Floating point variables shall not be tested for exact equality or inequality.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    if (x == y)                        /* MISRA Violation */
                                                                    {
                                                                        r = 1;
                                                                    }
                                                                    if (x != y)                        /* MISRA Violation */
                                                                    {
                                                                        r = -1;
                                                                    }
                                                                    return(r);
                                             }
dissemination and/or editing of this document as well as utilization of its
                                             QAC-Rule 3341
inventions, are reserved by VDOTransmittal, reproduction,
                                                          3341                             Maj_Ops            Comparing floating point expressions for equality (with '==' or '!=') is unlikely to
                                                                                                              give predictable results and should be avoided.
model or design patent are reserved.
Comparing floating point numbers can be very dangerous due to problems with precision.
                                             ...
                                             double a;
                                             ...
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   116 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             if (a ==0.0)
                                             {
                                                ...
                                             }
                                             If the value of 'a' is not exactly zero this could cause many problems. Some compilers may only check to a certain
                                             number of decimal places, making the above expression true although 'a' is not strictly zero. The value of 'a' may
                                             be so small that for your needs you would want it to act as zero but the compiler treats it as a value not equal to
                                             zero. Avoid using floating point values for comparisons.
                                             3.2.12 Control Flow, Misra-Rules 53*, 56, 57, 58, 59, 61, 62, 64, 65
                                             *= Supported with specified limitation for DAC
#include "misra.h"
                                             extern void test_053b( S32 x, const S32 *p, const volatile S32 *pv )
                                             {
                                                 S32 n = 0;
n = n;
x = 0, x + 1; /* MISRA Violation */
n; /* MISRA Violation */
                                                                    return;
                                             }
dissemination and/or editing of this document as well as utilization of its
                                             The left hand side of a comma operator is evaluated for its side effects only, and does not affect the value of the
                                             expression. In this case, the left hand side has no side effects and is therefore redundant. Removing it would
                                             make the expression more readable. e.g.
                                             for(i, j = strlen(s) - 1; i < j; i++, j--)
                                             ....
model or design patent are reserved.
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                               Status
                                                                                                                                                                                                  released
                                                                                                        Documentkey                                                                               Pages
                                                                                                                                                                                                  117 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The specified statement does no work - it has no effect on the state of the program - therefore the parser
                                             recommends you discard it.
                                             ...
                                             i;                          /* not a declaration so it changes nothing */
                                             ...
                                             Unused statements add to program complexity just by being there - adding lines to the program and causing
                                             readers to puzzle over its presence.
                                             Like variables which are no longer used, this statement should be removed.
                                             Note that this can also occur if the parser detects syntax errors previously.
                                                          3404                             Maj_Stmt            *p++ means *(p++) not (*p)++. The * operator is redundant.
                                             The increment operator has higher precedence than the pointer operator and so this expression is equivalent to
                                             "*(p++)". If p is not a pointer to a volatile, the * operator is redundant and the expression is equivalent to "p++".
                                                          3426                            Maj_SideEff           Right hand side of comma expression has no side effect and its value is not
                                                                                                                used.
                                             If the right hand operand of a comma expression has no side effect and it value is not used the meaning of the
                                             statement must be questioned. For example:
                                                    i = 1, j + 1;                  /* Message 3426 */
n = (i = 1, j + 1); /* OK */
                                                          3427                            Maj_SideEff          Right hand side of logical operator has no side effect.
                                             When using a dependent chain technique, one of the operands has no side effect (perhaps should have been
                                             increment or decrement operators). Was this intended? The following example displays the message:
                                             static void foo(void)
                                             {
                                                unsigned int a = 0U;
dissemination and/or editing of this document as well as utilization of its
                                                b++;
inventions, are reserved by VDOTransmittal, reproduction,
                                             Example Code:
model or design patent are reserved.
#include "misra.h"
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                Status
                                                                                                                                                                                                   released
                                                                                                        Documentkey                                                                                Pages
                                                                                                                                                                                                   118 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
mylabel:
                                                                    return(0);
                                             }
QAC-Rule 2001
#include "misra.h"
                                                                    r = 1;
dissemination and/or editing of this document as well as utilization of its
                                                                    return(r);
the property of VDO. This document and ll information is confidential.
                                             }
This document and the information ..............................................
                                             QAC-Rule 0770
                                                          0770                             Min_Ctrl          A continue statement should not be used.
                                             It is better to avoid 'continue' statements as far as possible. Programming standards often include this
                                             recommendation. For example:
model or design patent are reserved.
                                                        while (gi != 0)
                                                        {
                                                          gi++;
                                                          if (gi == MAX_VALUE)
                                                          {
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                              Status
                                                                                                                                                                                               released
                                                                                                      Documentkey                                                                              Pages
                                                                                                                                                                                               119 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 58: The break statement shall not be used (except to terminate the cases of a switch
                                             statement).
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    switch ( x )
                                                                    {
                                                                    case 1:
                                                                        n = 1;
                                                                        break;
                                                                    case 2:
                                                                        if (y > 0)
                                                                        {
                                                                            break;                                  /* MISRA Violation */
                                                                        }
                                                                        n = 2;
                                                                        break;
                                                                    default:
                                                                        n = 0;
                                                                        break;
                                                                    }
                                                                    return(0);
                                             }
dissemination and/or editing of this document as well as utilization of its
                                             It is good style to avoid 'break' statements as far as possible except in switch statements. Programming
                                             standards often include this recommendation. Message 769 will be generated whenever a break statement is
                                             encountered within a loop statement but outside a switch statement. For example:
                                                        while (gi != 0)
model or design patent are reserved.
                                                        {
                                                          gi++;
                                                          if (gi == VALUE)
                                                          {
                                                            break;     /* Message 769 */
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                120 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    }
                                                        }
                                                          3333                             Min_Ctrl           A break statement shall only be used at the end of all the statements in a
                                                                                                              switch case block.
                                             Break statements should be avoided as far as possible except in switch statements. Any break in control flow
                                             increases complexity which can affect maintainability and reliability. A 'break' can usually be avoided - perhaps by
                                             making the loop termination condition dependent upon a continuation flag. Message 3333 is functionally similar to
                                             message 769 - but is generated only in the context of an if statement within a switch construct. For example:
                                             switch(n)
                                             {
                                             case 1:
                                                 if (flag == 0)
                                                     break;    /* Message 3333 */
                                                 ...
                                                 break;
                                             case 2:
                                                 ...
                                             MISRA Rule 59: The statements forming the body of an if, else if, else, while, do ... while or for statement
                                             shall always be enclosed in braces.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    if (n == 2)
                                                                        n = 3;                                               /* MISRA Violation */
                                                                    else
                                                                        n = 2;                                               /* MISRA Violation */
                                                                    if (n == 5) n = 6;                                       /* MISRA Violation */
                                                                    else n = 7;                                              /* MISRA Violation */
dissemination and/or editing of this document as well as utilization of its
                                                                    while (n < 5)
the property of VDO. This document and ll information is confidential.
                                                                    do
                                                                        n++;                                                 /* MISRA Violation */
                                                                    while (n<9);
model or design patent are reserved.
                                                                    if (n != 0)
                                                                        if (n > 0)                                           /* MISRA Violation */
                                                                        {
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 121 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                            x = 1;
                                                                        }
                                                                    else
                                                                    {
                                                                        x = 2;
                                                                    }
                                                                    return(x);
                                             }
                                             QAC-Rules: 2212, 2214, 3402
                                                          2212                            Min_Brace           Braces should be used in control statements, even when the body has only
                                                                                                              one statement.
                                             It is good programming practice to enclose the body of a control statement within braces even when there is only
                                             one statement. By using braces you will create a visible grouping of statements. Programming errors can be
                                             caused when the body of a control statement without braces is expanded from one statement to many. If single
                                             statements were brace-enclosed from the start then the adding of new statements will avoid this common source
                                             of problems.
                                             Note that message 2214 is generated for the special case when the body of the control loop occurs on the same
                                             line as the control statement.
                                             For example:
                                             /* ... */
                                             if (n > 0)
                                                 ++x;                                        /* Message 2212 */
                                             if (n > 0)
                                             {
                                                 ++x;                                        /* OK */
                                             }
                                                          2214                            Min_Brace           Braces should be used in control statements, even when the body has only
                                                                                                              one statement.
                                             It is good programming practice to enclose the body of a control statement within braces even when there is only
                                             one statement. By using braces you will create a visible grouping of statements. Programming errors can be
                                             caused when the body of a control statement wihtout braces is expanded from one statement to many. If single
                                             statements were brace enclosed from the start then the adding of new statements will avoid this common source
                                             of problems.
                                             Message 2214 is generated when the body of the control loop occurs on the same line as as the control
                                             statement. Message 2212 is generated when the body of the control loop occurs on a separate line.
                                             For example:
                                             /* ... */
dissemination and/or editing of this document as well as utilization of its
                                             if (n > 0)
inventions, are reserved by VDOTransmittal, reproduction,
                                             if (n > 0)
                                             {
                                                 ++x;                                        /* OK */
                                             }
model or design patent are reserved.
3402 Min_Brace Braces should be used to clarify the structure of this 'if'-'if'-'else' statement.
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                   Status
                                                                                                                                                                                                    released
                                                                                                      Documentkey                                                                                   Pages
                                                                                                                                                                                                    122 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The absence of braces (and correct indentation) can be misleading, particularly where there are nested control
                                             statements. Code which is difficult to read is difficult to maintain. Braces should be used.
                                             For example:
                                                                    if (i > j)
                                                                        if (j > 0)
                                                                            i = j;
                                                                    else
                                                                        i = 0;
                                             It may not be clear to the reader whether the 'else' belongs to the inner or outer 'if' statement. Use braces and
                                             correct indentation to make it clear that the 'else' belongs to the inner 'if'.
                                             MISRA Rule 61: Every non-empty case clause in a switch statement shall be terminated with a break
                                             statement.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    switch (n)
                                                                    {
                                                                    case 0:                  /* OK */
                                                                    case 1:                  /* OK */
                                                                        x = 1;
                                                                        break;
                                                                    case 2:                  /* OK */
                                                                        x = 2;
                                                                    return(x);
                                             }
dissemination and/or editing of this document as well as utilization of its
                                             QAC-Rule 2003
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                                          2003                            Min_Switch           A non-empty 'case' or 'default' should end with an explicit 'break' or 'return'
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                               statement.
                                             It is not considered good practice to allow one case to fall through to the next in a switch statement unless the
                                             first case contains no statements of its own, i.e. both cases are processed in the same way.
                                             For example:
                                             switch (value)
model or design patent are reserved.
                                             {
                                             case ONE:
                                                 /* some statements - but no 'break'
                                                     so it 'falls through' to the next case */
                                             case TWO:
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   123 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                 /* ... */
                                                 break;
                                             case THREE:                                    /* fall through allowed */
                                             case FOUR:
                                                 /* ... */
                                                 break;
                                             default:
                                                 break;
                                             }
                                             Fall through is invariably overlooked when reviewing switch statements where the cases themselves are
                                             separated by statements. This can lead to unexpected results. It is probably better to group the two or more
                                             cases together and provide conditional code within the last case to make it clear that code is shared. At the very
                                             least you should comment the 'fall through' in order to draw attention to it.
                                             for example:
                                             switch (value)
                                             {
                                             case ONE:
                                             case TWO:
                                                 if (value == ONE)
                                                 {
                                                     /* case ONE specific statements */
                                                 }
                                                 /* ... */
                                                 break;
                                                 /* ... */
                                             }
                                             MISRA Rule 62: All switch statements should contain a final default clause.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    switch (n)
                                                                    {
                                                                    case 0:
                                                                        x = 0;
                                                                        break;
                                                                    case 1:
                                                                        x = 1;
                                                                        break;
                                                                    }                                 /* MISRA Violation */
dissemination and/or editing of this document as well as utilization of its
                                                                    switch (n)
This document and the information ..............................................
                                                                    {
                                                                    default:
inventions, are reserved by VDOTransmittal, reproduction,
                                                                        x = 7;
                                                                        break;
                                                                    case 2:
                                                                        x = 5;
                                                                        break;
model or design patent are reserved.
                                                                    case 3:
                                                                        x = 6;
                                                                        break;
                                                                    }                                 /* MISRA Violation */
                                                                                                                              Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                   2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                          Status
                                                                                                                                                                                          released
                                                                                                     Documentkey                                                                          Pages
                                                                                                                                                                                          124 of 181
                                                   Siemens VDO Automotive AG                                                                            Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    return(x);
                                             }
                                                         2009                            Min_Switch         The default case label shall be placed last within a switch block.
                                             The "default" case label is usually positioned at the end of a switch block. To position it elsewhere is likely to
                                             cause confusion.
                                             MISRA Rule 64: Every switch statement shall have at least one case.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    switch (n)
                                                                    {
                                                                    default:                            /* MISRA Violation */
                                                                        x=2;
                                                                        break;
                                                                    }
                                                                    return(x);
                                             }
QAC-Rule 3315
                                                      3315                             Min_Switch      This 'switch' statement contains only a single path - it is redundant.
                                             A switch statement with only a default clause is a redundant construct. e.g.
                                             switch(n)
                                             {
                                                default:                                   /* no case statements */
                                                   i=1;
dissemination and/or editing of this document as well as utilization of its
                                                   break;
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             }
This document and the information ..............................................
                                             MISRA Rule 65: Floating point variables shall not be used as loop counters.
inventions, are reserved by VDOTransmittal, reproduction,
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
model or design patent are reserved.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   125 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    return(x);
                                             }
                                             QAC-Rule 3340
                                                        3340                              Min_Ctrl         Floating point 'for' loop index. This should be replaced by an integral type.
                                             QAC identifies a "control variable", by examining the loop control statements. The use of a floating variable is
                                             unconventional and should be avoided.
                                             3.2.13 Functions, Misra-Rules: 68, 69, 70*, 72, 73, 75, 76, 78, 79, 80, 82, 83, 84
                                             *= Supported with specified limitation for DAC
#include "misra.h"
f();
                                                                    return(0);
                                             }
                                             QAC-Rule 3221
                                                          3221                              Min_Decl             Functions shall not be declared at block scope.
                                             Function declarations are permitted at block scope level, i.e. within a function, by the ISO standard, but good
                                             practice dictates that they should always be placed at file scope and preferably within a header file. For example:
                                             void foo(int a) { extern int myfunc(int x); /* Message 3221 */ int r; r = myfunc(a); ... }
MISRA Rule 69: Functions with variable numbers of arguments shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
dissemination and/or editing of this document as well as utilization of its
                                             #include "misra.h"
This document and the information ..............................................
test_069b(1, "harry");
                                                                    return(0);
                                             }
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  126 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 70*: Functions shall not call themselves, either directly or indirectly:
                                             To apply complete coverage of this rule, it is necessary to run the MCM Global Checks report on your project.
                                             This will check for violations of Rule 70 Project wide. The global test recursively descends down each function,
                                             seeing if it calls itself along any of its potential call paths. The global test returns the first circular path it comes
                                             across. QAC checks for a function calling itself.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             {
This document and the information ..............................................
                                                 test_070b();
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   127 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             The function is recursive. Recursive functions can be dangerous, in that they have the potential to go into infinite
                                             loops. Use the relationships browser in order to see more complicated function call orders which may lead to
                                             recursive behaviour.
                                             int fib(int n)
                                             {
                                                 /* this is a safe recursive function or is it? fib(-1)!*/
                                                 if (n==0 || n==1)
                                                 {
                                                     return 1;
                                                 }
                                                 return fib(n-1)+ fib(n-2);
                                             }
5070 MISRA_Rule_70_Req_ Functions shall not call themselves, either directly or indirectly:
                                             MISRA Rule 72: For each function parameter the type given in the declaration and definition shall be
                                             identical, and the return types shall also be identical.
                                             Note: Part of this implementation is the same as Rule26 (Messages 626-628).
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    return(0.0F);
                                             }
                                             }
the property of VDO. This document and ll information is confidential.
                                                          1331                             Maj_Func           Type or number of arguments doesn't match previous use of the function.
                                             This message will only be generated whan a function is being called in the absence of a prototype. It is always
model or design patent are reserved.
                                             advisable to use function prototypes consistently throughout your source code; but be aware that it can be
                                             dangerous to use them in some places but not in others. When functions are called in the absence of a prototype,
                                             arguments of type char, short and float are subject to default argument promotion. For example:
                                                                    int r;
                                                                                                                                         Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                              2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                     Status
                                                                                                                                                                                                      released
                                                                                                      Documentkey                                                                                     Pages
                                                                                                                                                                                                      128 of 181
                                                   Siemens VDO Automotive AG                                                                                        Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    int a;
                                                                    long b;
                                                                    /* ... */
                                                                    r = foo(a);                                           /* Function call with no previous prototype */
                                                                    r = foo(b);                                           /* Message 1331 */
                                                                    r = foo(a, b);                                        /* Message 1331 */
                                                          1332                             Maj_Func           Type or number of arguments doesn't match prototype found later.
                                             This message will only be generated whan a function is being called in the absence of a previous prototype or
                                             function definition. It is always advisable to use function prototypes consistently throughout your source code.
                                             Function prototypes are best located in header files and should always be positioned before any function calls. It
                                             can be dangerous to use them in some places but not in others. When functions are called in the absence of a
                                             prototype, arguments of type char, short and float are subject to default argument promotion.
                                             For example:
                                             {
                                                 int r;
                                                 int a;
                                                 /* ... */
                                                 r = foo(a);                                                              /* Type of argument conflicts with subsequent
                                             prototype */
                                                 /* ... */
                                             }
                                             extern int foo ( long a );                                                   /* Prototype conflicts with previous usage of function
                                             */
                                                          1333                             Maj_Func           Type or number of arguments doesn't match function definition found later.
                                             This message will only be generated whan a function is being called in the absence of a previous prototype or
                                             function definition. It is always advisable to use function prototypes consistently throughout your source code,
                                             even and especially when the source file contains the function definition. Function prototypes are best located in
                                             header files and should always be positioned before any function calls. It can be dangerous to use them in some
                                             places but not in others. When functions are called in the absence of a prototype, arguments of type char, short
                                             and float are subject to default argument promotion.
                                             For example:
                                             {
                                                                    int r;
                                                                    int a;
                                                                    /* ... */
                                                                    r = foo(a);                             /* Type of argument conflicts with subsequent prototype */
                                                                    /* ... */
                                             }
                                                 /* ... */
the property of VDO. This document and ll information is confidential.
                                             }
This document and the information ..............................................
                                             MISRA Rule 73: Identifiers shall either be given for all of the parameters in a function prototype
                                             declaration, or for none.
                                             Example Code:
#include "misra.h"
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                129 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             QAC-Rule 0652
                                                          0652                             ISO_ImpU           [u] Identifiers should be given for all or none of the parameters in a function
                                                                                                              prototype.
                                             The ISO standard requires that, in a function prototype, all of the parameters should be specified as types only or
                                             all parameters be specified named. For example:
                                             static void a(int y, int); /* Illegal */
                                             MISRA Rule 75: Every function shall have an explicit return type.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             QAC-Rule 2050
                                                       2050                              Min_Decl        The 'int' type specifier should not be omitted from function declarations.
                                             This function declaration does not explicitly specify a type. This results an an implicit 'int' type for the declaration.
                                             This is a legitimate practice in C, but is not recommended for reasons of clarity and readability.
                                             extern foo(void);                                      /* Message 2050 */
                                             MISRA Rule 76: Functions with no parameters shall be declared with parameter type void.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(0);
                                             }
QAC-Rule 1303
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  130 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                        1303                             Maj_Func         An empty parameter list in a function type has a different meaning in C++.
                                             In C, function declarations with an empty parameter list are an obsolescent way of declaring a function and it
                                             leaves the number of arguments required by the function undefined. It is bad practice to define functions like this
                                             in a modern ISO C environment where a function interface can be defined with a full prototype. If a function is
                                             defined as having no parameters, the parameter list should be specified with the single keyword "void".
                                             In C++, a function declaration with an empty parameter list is defined to mean that the function takes no
                                             parameters. Always use '(void)' if the function has no parameters.
                                             Old style function declarations should be avoided because they also have other hazards in the way that
                                             arguments are handled because they introduce the mechanism of "default argument promotion".
                                             MISRA Rule 78: The number of parameters passed to a function shall match the function prototype.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    return;
                                             }
                                                      0422                              Constraint    [C] Function call contains fewer arguments than prototype specifies.
                                             A function is called with fewer arguments than the prototype specifies. This is a language constraint violation and
                                             is very dangerous as it may lead to corruption of the stack. For example:
                                             int foo(int a, int b);
                                                              ...
                                                              ret = foo(x);                                         /* func call with few arguments */
                                                      0423                             Constraint     [C] Function call contains more arguments than prototype specifies.
                                             To call a function with more arguments than the prototype specifies is a language constraint violation. The extra
                                             arguments are not used. For example:
                                             int foo(int a, int b);
dissemination and/or editing of this document as well as utilization of its
                                                              ...
This document and the information ..............................................
                                                          3319                             ISO_ExpU           [U] Function called with number of arguments which differs from number of
                                                                                                              arguments of definition.
                                             A function should be called with the same number of arguments as the definition. Calling functions with a different
model or design patent are reserved.
                                             number of arguments from the definition leads to undefined bahaviour. Possible exceptions are functions with a
                                             prototype ending in an ellipsis (,...) such as printf() which can be called with a variable number of arguments.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                131 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             This message is only generated when the function definition is provided by an old style function header. If the
                                             interface has been defined with a full prototype or ISO header, message 422 or 423 will be generated instead.
                                             For example:
                                             static int boo();
                                             int main(void)
                                             {
                                                int ret;
MISRA Rule 79: The values returned by void functions shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    return(i);
                                             }
dissemination and/or editing of this document as well as utilization of its
                                             QAC 0543
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                                        0543                             ISO_ExpU        [U] 'void' expressions have no value and may not be used in expressions.
inventions, are reserved by VDOTransmittal, reproduction,
                                             The (nonexistent) value of an expression of type void cannot be used in any way, and implicit or explicit
                                             conversions (except to void) cannot be applied to such an expression. For example:
                                                  extern void foo(void);
                                                  ...
                                                  if ( foo( ) == 0)                  /* Message 543 */
model or design patent are reserved.
                                                  {
                                                       ...
                                                                                                                                 Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                      2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                             Status
                                                                                                                                                                                             released
                                                                                                     Documentkey                                                                             Pages
                                                                                                                                                                                             132 of 181
                                                   Siemens VDO Automotive AG                                                                               Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 80: Void expressions shall not be passed as function parameters.
                                             This rule is implicitly enforced through Rule 79
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    return;
                                             }
                                             QAC 0541
                                                          0541                            ISO_ImpU           [u] Argument no. %s does not have object type.
                                             All arguments to a function call must be expressions of object type. For example struct T1 below is an incomplete
                                             type and hence cannot be used as a parameter. For example:
#include "misra.h"
                                                                    if (i > 0)
                                                                    {
                                                                        return(0);
                                                                    }
                                                                    else
                                                                    {
                                                                        return(1);
dissemination and/or editing of this document as well as utilization of its
                                                                    }
damages. All rights created by patent grant or registration of a utility
                                             }                                                                      /* MISRA Violation */
This document and the information ..............................................
                                             QAC-Rule 2006
                                                          2006                             Min_Func          '%s()' has more than one 'return' path.
                                             Good programming practice should produce structured functions with one entry and one exit. More than one exit
                                             point indicates a forced break in control flow and, like any break in control flow, leads to code which is more
model or design patent are reserved.
                                             difficult to read and maintain. Note that one of the return paths referred to in this message may be an implicit
                                             "return;" statement at the end of the function.
                                             void func(void)
                                             {
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 133 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                 if (...)
                                                 {
                                                     ...
                                                     return;        /* break out of function */
                                                 }
                                                 ...             /* remaining skipped statements */
                                             }       /* normal exit point */
                                             By restructuring the code it is always possible to create a 'one entry - one exit' function.
                                             MISRA Rule 83: Functions with non-void return type shall have: i) one return statement for every exit
                                             branch (including the end of the program), ii) each return shall have an expression, iii) the expression
                                             shall match the return type.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    r = i + 2;
                                             }
r = j + 2;
                                             }
This document and the information ..............................................
                                                                    case 3:
                                                                        return 0;                                  /* MISRA Violation */
                                                                                                                                 Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                      2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                             Status
                                                                                                                                                                                             released
                                                                                                     Documentkey                                                                             Pages
                                                                                                                                                                                             134 of 181
                                                   Siemens VDO Automotive AG                                                                               Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    case 4:
                                                                        return fruit;                               /* MISRA Violation */
                                                                    case 6:
                                                                        return n;                                   /* MISRA Violation */
                                                                    default:
                                                                        return Red;
                                                                    }
                                             }
                                             QAC-Rules: 0744, 0745, 1403, 1413, 1423, 1433, 1443, 3900 – 3913, 3915, 3917, 3919 - 3923, 3925, 3927,
                                             3929 – 3936, 3938, 3940 – 3948, 3950, 3952 – 3960, 3962 – 3972, 3974 – 4007, 4010 – 4019, 4021 – 4034,
                                             4037, 4039, 4040, 4043, 4047, 4048, 4050 – 4081
                                                          0744                             ISO_ExpU           [U] '%s()' has been declared with a non void result type but ends with an implicit
                                                                                                              'return ;' statement.
                                             This function has been explicitly defined as having a non-void return type but ends with an implicit return
                                             statement which returns no value. This will always return an undefined value. e.g.
                                             float func(void)
                                             {
                                                /* no return statement */
                                             }
                                                          0745                             ISO_ExpU           [U] 'return;' found in '%s()', which has been defined with a non-'void' return type.
                                             This return statement has no return expression although a non-void return type for the function has been defined.
                                             The value returned by the function is undefined. e.g.
                                             float func(void)
                                             {
                                                /* ... */
                                                return;
                                             }
                                             {
                                               small,
inventions, are reserved by VDOTransmittal, reproduction,
                                               medium,
                                               large
                                             } SIZE;
                                             {
                                               red,
                                               green,
                                               blue,
                                               yellow
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  135 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
} COLOUR;
                                             SIZE test(void)
                                             {
                                                ...
                                                return 2;                                           /* Message 1413 */
                                             }
                                               medium,
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                               large
This document and the information ..............................................
                                             } SIZE;
inventions, are reserved by VDOTransmittal, reproduction,
                                               yellow
                                             } COLOUR;
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               136 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                        return 0;
                                             }
                                                              {
                                                                box = paper;                             /* assignment of enum object */
inventions, are reserved by VDOTransmittal, reproduction,
                                                              }
                                                              else if (box == paper)                     /* equality comparison with enum object */
                                                              {
                                                                foo(paper);                              /* argument passed is enum object */
                                                              }
model or design patent are reserved.
1443 Min_Enum Return of non enum type to enum, and may be out of range.
                                                                                                                                 Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                      2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                              Status
                                                                                                                                                                                              released
                                                                                                     Documentkey                                                                              Pages
                                                                                                                                                                                              137 of 181
                                                   Siemens VDO Automotive AG                                                                                Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             You are returning a non enum type when enum object is expected. While legal, this could represent
                                             maintainability and readability problems. Also, the value of this type could be outside the range of the enum.
                                             Following are examples of potential issues in usage of non enum types in place of enum objects:
                                             typedef enum _SIZE
                                             {
                                               small,
                                               medium,
                                               large
                                             } SIZE;
                                                              if (box < paper)                            /* comparison between non enum type and enum object */
                                                              {
                                                                box = paper;                              /* assignment of non enum object */
                                                              }
                                                              else if (box == paper)                      /* equality comparison between non enum type and enum object */
                                                              {
                                                                foo(paper);                               /* argument passed is non enum object */
                                                              }
                                                              return paper;                               /* return of non enum object */
                                             }
                                             Implicit casts should be avoided. The result of a conversion to or from a plain 'char' datatype will depend on
inventions, are reserved by VDOTransmittal, reproduction,
                                             whether the plain 'char' datatype is signed or unsigned. This is implementation defined behaviour and it is not
                                             wise to make any assumptions. It is safer not to mix 'char' types in expressions.
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  138 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             Implicit casts should be avoided. The result of a conversion to or from a plain 'char' datatype will depend on
contents and communication there of to others without express
                                             whether the plain 'char' datatype is signed or unsigned. This is implementation defined behaviour and it is not
inventions, are reserved by VDOTransmittal, reproduction,
wise to make any assumptions. It is safer not to mix 'char' types in expressions.
                                                          3912                            Maj_UStoS          unsigned char value returned from signed char %s().
                                             An object of type unsigned char is being implicitly cast to a signed char.
model or design patent are reserved.
                                             Implicit casts should be avoided. An unsigned value is being converted to a signed type - the result may be
                                             negative.
                                                                                                                                      Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                    Status
                                                                                                                                                                                                     released
                                                                                                      Documentkey                                                                                    Pages
                                                                                                                                                                                                     139 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3923                            Maj_StoUS           signed char value returned from unsigned char %s().
                                             An object of type signed char is being implicitly cast to an unsigned char.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
                                                          3925                            Maj_StoUS           signed char value returned from unsigned short %s().
                                             An object of type signed char is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
                                                          3927                            Maj_StoUS           signed char value returned from unsigned int %s().
                                             An object of type signed char is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided. A signed datatype is being converted to an unsigned datatype and negative
                                             values will be converted to large positive values.
dissemination and/or editing of this document as well as utilization of its
                                                          3929                            Maj_StoUS           signed char value returned from unsigned long %s().
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 140 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3932                             Maj_ItoFL          signed char value returned from long double %s().
                                             An object of type signed char is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
This document and the information ..............................................
                                             values.
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 141 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
                                             A type conversion will be performed.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
                                             values.
                                             A value of type short is being returned from a function that is defined with type long double.
contents and communication there of to others without express
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                                                                                                     Date             Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12       SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     142 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type unsigned short is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
                                             {
                                                 unsigned short ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3946                            Maj_Small          unsigned short value returned from unsigned char %s().
                                             A value of type unsigned short is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                  unsigned short ret;
                                                  /* ... */
                                                  return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             A value of type unsigned short is being returned from a function that is defined with type short.
dissemination and/or editing of this document as well as utilization of its
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                143 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type int is being returned from a function that is defined with type char.
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             The result of a conversion to or from a plain 'char' type is dependent on whether plain 'char' is signed or not.
                                                                                                                                     Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  144 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type int is being returned from a function that is defined with type unsigned short.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             {
                                                 int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
model or design patent are reserved.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
                                             values.
                                                                                                                                    Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  145 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
This document and the information ..............................................
                                                 int ret;
contents and communication there of to others without express
                                                 /* ... */
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                      Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    146 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3967                            Maj_UStoS          unsigned int value returned from signed char %s().
                                             A value of type unsigned int is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3968                            Maj_Small          unsigned int value returned from unsigned char %s().
                                             A value of type unsigned int is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
dissemination and/or editing of this document as well as utilization of its
                                                 return(ret);
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             }
This document and the information ..............................................
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                147 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3970                            Maj_Small           unsigned int value returned from unsigned short %s().
                                             A value of type unsigned int is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             }
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 148 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          3976                             Maj_ItoFL          unsigned int value returned from long double %s().
                                             A value of type unsigned int is being returned from a function that is defined with type long double.
                                             The situation is illustrated below:
                                             long double foo ( void )
                                             {
                                                 unsigned int ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          3977                            Maj_Pchar           long value returned from char %s().
                                             A value of type long is being returned from a function that is defined with type char.
                                             The situation is illustrated below:
                                             char foo ( void )
                                             {
                                                 long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             The result of a conversion to or from a plain 'char' type is dependent on whether plain 'char' is signed or not.
                                             A value of type long is being returned from a function that is defined with type unsigned char.
This document and the information ..............................................
                                                                                                                                    Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   149 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
This document and the information ..............................................
                                                 long ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
model or design patent are reserved.
values.
                                                                                                                                    Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   150 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type long is being returned from a function that is defined with type unsigned long.
                                             The situation is illustrated below:
                                             unsigned long foo ( void )
                                             {
                                                 long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             A signed type is being converted to an unsigned type and so negative values will be converted to large positive
                                             values.
                                                 /* ... */
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                                 return(ret);
prior written consent of VDO. All rigths, especially with regard to
                                             }
inventions, are reserved by VDOTransmittal, reproduction,
                                             A value of type unsigned long is being returned from a function that is defined with type char.
                                             The situation is illustrated below:
                                             char foo ( void )
                                             {
                                                 unsigned long ret;
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    151 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    /* ... */
                                                                    return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             The result of a conversion to or from a plain 'char' type is dependent on whether plain 'char' is signed or not.
                                                          3989                            Maj_UStoS          unsigned long value returned from signed char %s().
                                             A value of type unsigned long is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                                          3990                            Maj_Small          unsigned long value returned from unsigned char %s().
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                             When an unsigned type is converted to a signed type, the result may be negative.
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                          3992                            Maj_Small          unsigned long value returned from unsigned short %s().
inventions, are reserved by VDOTransmittal, reproduction,
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 unsigned long ret;
model or design patent are reserved.
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                              Status
                                                                                                                                                                                               released
                                                                                                      Documentkey                                                                              Pages
                                                                                                                                                                                               152 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
The conversion is taking place to a smaller datatype and may result in loss of information.
                                                          3994                            Maj_Small           unsigned long value returned from unsigned int %s().
                                             A value of type unsigned long is being returned from a function that is defined with type unsigned int.
                                             The situation is illustrated below:
                                             unsigned int foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             The conversion is taking place to a smaller datatype and may result in loss of information.
                                                          3995                            Maj_UStoS           unsigned long value returned from long %s().
                                             A value of type unsigned long is being returned from a function that is defined with type long.
                                             The situation is illustrated below:
                                             long foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             When an unsigned type is converted to a signed type, the result may be negative.
                                             {
This document and the information ..............................................
                                                 /* ... */
inventions, are reserved by VDOTransmittal, reproduction,
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 153 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          3998                             Maj_ItoFL          unsigned long value returned from long double %s().
                                             A value of type unsigned long is being returned from a function that is defined with type long double.
                                             The situation is illustrated below:
                                             long double foo ( void )
                                             {
                                                 unsigned long ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             {
                                                 float ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    154 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
This document and the information ..............................................
                                                  float ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                  /* ... */
                                                  return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                        Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                   Status
                                                                                                                                                                                                     released
                                                                                                       Documentkey                                                                                   Pages
                                                                                                                                                                                                     155 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
                                                                    float ret;
                                                                    /* ... */
                                                                    return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             A value of type double is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 double ret;
model or design patent are reserved.
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 156 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
This document and the information ..............................................
                                                 double ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                                                                                                     Date            Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12      SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    157 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             A value of type long double is being returned from a function that is defined with type char.
                                             The situation is illustrated below:
                                             char foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
dissemination and/or editing of this document as well as utilization of its
                                                          4022                            Maj_FLtoI           long double value returned from signed char %s().
                                             A value of type long double is being returned from a function that is defined with type signed char.
                                             The situation is illustrated below:
                                             signed char foo ( void )
model or design patent are reserved.
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 158 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4023                             Maj_FLtoI          long double value returned from unsigned char %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned char.
                                             The situation is illustrated below:
                                             unsigned char foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4025                             Maj_FLtoI          long double value returned from unsigned short %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned short.
                                             The situation is illustrated below:
                                             unsigned short foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             {
                                                 long double ret;
inventions, are reserved by VDOTransmittal, reproduction,
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
model or design patent are reserved.
                                                          4027                             Maj_FLtoI          long double value returned from unsigned int %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned int.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 159 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4029                             Maj_FLtoI          long double value returned from unsigned long %s().
                                             A value of type long double is being returned from a function that is defined with type unsigned long.
                                             The situation is illustrated below:
                                             unsigned long foo ( void )
                                             {
                                                 long double ret;
                                                 /* ... */
                                                 return(ret);
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                             }
damages. All rights created by patent grant or registration of a utility
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 160 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             }
                                             A type conversion will be performed.
                                             There may be a loss of precision.
                                                          4033                            Maj_Pchar          char value returned from unsigned long long %s().
                                             An object of type char is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4034                           Maj_UStoLS          unsigned char value returned from long long %s().
                                             An object of type unsigned char is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4037                            Maj_StoUS          signed char value returned from unsigned long long %s().
                                             An object of type signed char is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4039                            Maj_StoUS          short value returned from unsigned long long %s().
                                             An object of type short is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4040                           Maj_UStoLS          unsigned short value returned from long long %s().
                                             An object of type unsigned short is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                          4043                            Maj_StoUS          int value returned from unsigned long long %s().
                                             An object of type int is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                          4044                           Maj_UStoLS          unsigned int value returned from long long %s().
                                             An object of type unsigned int is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
dissemination and/or editing of this document as well as utilization of its
                                                          4047                            Maj_StoUS          long value returned from unsigned long long %s().
This document and the information ..............................................
                                                          4048                           Maj_UStoLS          unsigned long value returned from long long %s().
                                             An object of type unsigned long is being implicitly cast to a long long.
model or design patent are reserved.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                161 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          4051                        Maj_Small long long value returned from signed char %s().
                                             An object of type long long is being implicitly cast to a signed char.
                                             Implicit casts should be avoided.
                                                          4052                            Maj_StoUS           long long value returned from unsigned char %s().
                                             An object of type long long is being implicitly cast to an unsigned char.
                                             Implicit casts should be avoided.
                                                          4054                            Maj_StoUS           long long value returned from unsigned short %s().
                                             An object of type long long is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided.
                                                              4056                         Maj_StoUS          long long value returned from unsigned int %s().
                                             An object of type long long is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided.
                                                              4058                         Maj_StoUS          long long value returned from unsigned long %s().
                                             An object of type long long is being implicitly cast to an unsigned long.
                                             Implicit casts should be avoided.
                                                              4059                         Maj_StoUS          long long value returned from unsigned long long %s().
                                             An object of type long long is being implicitly cast to an unsigned long long.
dissemination and/or editing of this document as well as utilization of its
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 162 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                              4062                         Maj_ItoFL          long long value returned from long double %s().
                                             An object of type long long is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                                              4063                         Maj_Pchar          unsigned long long value returned from char %s().
                                             An object of type unsigned long long is being implicitly cast to a char.
                                             Implicit casts should be avoided.
                                                              4064                         Maj_UStoS          unsigned long long value returned from signed char %s().
                                             An object of type unsigned long long is being implicitly cast to a signed char.
                                             Implicit casts should be avoided.
                                                              4065                         Maj_Small          unsigned long long value returned from unsigned char %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned char.
                                             Implicit casts should be avoided.
                                                              4066                         Maj_UStoS          unsigned long long value returned from short %s().
                                             An object of type unsigned long long is being implicitly cast to a short.
                                             Implicit casts should be avoided.
                                                              4067                         Maj_Small          unsigned long long value returned from unsigned short %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned short.
                                             Implicit casts should be avoided.
                                                              4068                         Maj_UStoS          unsigned long long value returned from int %s().
                                             An object of type unsigned long long is being implicitly cast to an int.
                                             Implicit casts should be avoided.
                                                              4069                         Maj_Small          unsigned long long value returned from unsigned int %s().
                                             An object of type unsigned long long is being implicitly cast to an unsigned int.
                                             Implicit casts should be avoided.
                                                              4070                         Maj_UStoS          unsigned long long value returned from long %s().
                                             An object of type unsigned long long is being implicitly cast to a long.
                                             Implicit casts should be avoided.
dissemination and/or editing of this document as well as utilization of its
                                                              4071                         Maj_Small          unsigned long long value returned from unsigned long %s().
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             An object of type unsigned long long is being implicitly cast to an unsigned long.
inventions, are reserved by VDOTransmittal, reproduction,
                                                              4072                         Maj_UStoS          unsigned long long value returned from long long %s().
                                             An object of type unsigned long long is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
model or design patent are reserved.
                                                              4073                         Maj_ItoFL          unsigned long long value returned from float %s().
                                             An object of type unsigned long long is being implicitly cast to a float.
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                               Status
                                                                                                                                                                                                 released
                                                                                                       Documentkey                                                                               Pages
                                                                                                                                                                                                 163 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                              4074                         Maj_ItoFL           unsigned long long value returned from double %s().
                                             An object of type unsigned long long is being implicitly cast to a double.
                                             Implicit casts should be avoided.
                                                              4075                         Maj_ItoFL           unsigned long long value returned from long double %s().
                                             An object of type unsigned long long is being implicitly cast to a long double.
                                             Implicit casts should be avoided.
                                                              4077                         Maj_FLtoI           float value returned from unsigned long long %s().
                                             An object of type float is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                              4079                         Maj_FLtoI           double value returned from unsigned long long %s().
                                             An object of type double is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
                                                              4080                         Maj_FLtoI           long double value returned from long long %s().
                                             An object of type long double is being implicitly cast to a long long.
                                             Implicit casts should be avoided.
                                                              4081                         Maj_FLtoI           long double value returned from unsigned long long %s().
                                             An object of type long double is being implicitly cast to an unsigned long long.
                                             Implicit casts should be avoided.
MISRA Rule 84: For functions with void return type, return statements shall not have an expression.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
dissemination and/or editing of this document as well as utilization of its
                                             #include "misra.h"
This document and the information ..............................................
                                             QAC-Rule 0746
                                                              0746                         Constraint          [C] 'return exp;' found in '%s()' whose result type is 'void'.
                                             The ISO standard forbids the presence of a return statement (with a return expression) in a function whose return
                                             type is 'void'. e.g.
                                                                                                                                        Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                             2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                                  Status
                                                                                                                                                                                                     released
                                                                                                        Documentkey                                                                                  Pages
                                                                                                                                                                                                     164 of 181
                                                   Siemens VDO Automotive AG                                                                                       Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             void func(void)
                                             {
                                                int i;
                                                /* ... */
                                                return i;    /* illegal */
                                             }
3.2.14 Preprocessing Directives, Misra-Rules: 88, 89, 91, 94, 95, 96, 98, 99, 100
                                             MISRA Rule 88: Non-standard characters shall not occur in header file names in #include directives.
                                             QAC Messages 0815, 0816 have been taken out of this release, as they are more restrictive than MISRA
                                             dictates. Example Code:
                                             /* Permit nested C-style comments: */
                                             #pragma PRQA_MESSAGES_OFF 3108
#include "misra.h"
                                                          0813                             ISO_ExpU           [U] Using any of the characters ' " \\ or /* in '#include <%s>' gives undefined
                                                                                                              behaviour.
                                             The characters ',",\ and the string /* should not be used as part of the filename in a #include statement. This
                                             means, for example, that the use of absolute path names in a PC environment is not supported. Avoid the use of
                                             absolute paths. Compilers will accept them but it is better to separate path information from source code by using
                                             the include path option to specify where files are located. For example:
                                             #include <C:\project\header.h>                                                 /* Message 813 */
                                                          0814                             ISO_ExpU           [U] Using any of the characters ' \\ or /* in '#include "%s"' gives undefined
                                                                                                              behaviour.
                                             The characters ', \ and the string /* should not be used as part of the filename in a #include "..." statement. This
                                             means, for example, that the use of absolute path names in a PC environment is not supported. Avoid the use of
                                             absolute paths. Compilers will accept them but it is better to separate path information from source code by using
                                             the include path option to specify where files are located. e.g.
dissemination and/or editing of this document as well as utilization of its
                                                          0831                             Lang_ext           [E] Use of '\\' in this '#include' line is a PC extension - '/' has been assumed.
                                                                                                              This usage is non-portable.
                                             Specifying paths for include files is considered bad practice as the code becomes non-portable. In a PC
                                             environment the path separator character '\' presents particular problems because, in the C language, it is used
                                             to introduce escape sequences in text strings. In this case the parser has identified a situation where PC paths
model or design patent are reserved.
                                             have been used i.e. '\'. If paths have to be specified , the use of Unix style '/' include paths would result in the
                                             code being more portable.
                                                                                                                                      Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                  Status
                                                                                                                                                                                                   released
                                                                                                      Documentkey                                                                                  Pages
                                                                                                                                                                                                   165 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 89: The #include directive shall be followed by either a <filename> or "filename" sequence.
                                             The rule is interpreted to mean that the only other meaningful alternative form of a #include statement (use of a
                                             macro to specify the filename) is not permitted. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #define INC <misra.h>
MISRA Rule 91: Macros shall not be #define'd and #undef'd within a block.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include "misra.h"
dissemination and/or editing of this document as well as utilization of its
                                             #define                                 L       5
the property of VDO. This document and ll information is confidential.
                                             QAC-Rule 0842
                                                          0842                            Min_Prepro          Macros shall not be #define'd and #undef'd within a block.
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                Status
                                                                                                                                                                                                  released
                                                                                                       Documentkey                                                                                Pages
                                                                                                                                                                                                  166 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             It is quite legal to place #define and #undef directives anywhere in source code because macros are not subject
                                             to scoping rules like other identifiers. A macro definition is effective only following the point of definition in the
                                             source code. However it can be considered good practice to use #define and #undef directives only at the top of
                                             a source file (i.e. at file scope) to avoid any possible confusion. For example:
                                             #define M1
MISRA Rule 94: A function-like macro shall not be 'called' without all of its arguments.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    k = MAX(i,1);
                                                                    k = MAX(i);                          /* MISRA Violation */
                                                                    return(k);
                                             }
                                                          0856                             Constraint          [C] Fewer arguments in macro call than specified in definition.
inventions, are reserved by VDOTransmittal, reproduction,
                                             The macro call has been passed fewer arguments than were specified in the function-like macro definition.
                                             #define MAX(a,b) ((a)>(b) ? (a) : (b))
                                             ...
is illegal because the MAX() macro was expecting two arguments but was only given one.
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                        Designation                                                                               Status
                                                                                                                                                                                                  released
                                                                                                        Documentkey                                                                               Pages
                                                                                                                                                                                                  167 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 95: Arguments to a function-like macro shall not contain tokens that look like pre-processing
                                             directives.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             #define _ANSI_
                                             #define STD(X) (X)
                                             QAC-Rule 0853
                                                          0853                             ISO_ExpU           [U] Macro arguments contain a sequence of tokens that has the form of a
                                                                                                              preprocessing directive.
                                             The ISO standard states that if there are sequences of preprocessing tokens within the list of arguments that
                                             would otherwise act as preprocessing directives, the behaviour is undefined. Hence embedding preprocessor
                                             directives as macro arguments may lead to portability problems. For example:
                                             PRE_PROC_ARGS(
                                             #ifdef 1
                                             1
                                             #else
                                             12
                                             #endif
                                             )
                                             MISRA Rule 96: In the definition of a function-like macro the whole definition, and each instance of a
                                             parameter, shall be enclosed in parentheses.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
dissemination and/or editing of this document as well as utilization of its
                                             #include "misra.h"
the property of VDO. This document and ll information is confidential.
                                             #define                                 MAXCONST    5                               /*   OK */
inventions, are reserved by VDOTransmittal, reproduction,
                                             {
                                                 S32 k = MAXCONST;
                                                                    k = MAX1(i,j);
                                                                    k = RMAX(i,j);
                                                                                                                                      Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                           2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                 Status
                                                                                                                                                                                                  released
                                                                                                      Documentkey                                                                                 Pages
                                                                                                                                                                                                  168 of 181
                                                   Siemens VDO Automotive AG                                                                                    Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 98: There shall be at most one occurrence of the # or ## pre-processor operators in a single
                                             macro definition.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             {
inventions, are reserved by VDOTransmittal, reproduction,
                                             The order in which the # and ## operators are evaluated by the preprocessor is unspecified by the C standard. It
                                             is therefore not advisable to use both operators within the same macro. This message will be generated by a
                                             statement such as:
                                             #define debug(s) printf("x" # s"=%d\n", x ## s)
                                                                                                                                     Date           Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12     SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   169 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 99: All uses of the #pragma directive shall be documented and explained.
                                             The QAC warning will identify the use of any #pragma directives that have not been specifically declared in the
                                             QAC configuration. Example Code:
                                             #include "misra.h"
                                             QAC-Rule 3116
                                                          3116                            Min_Prepro           Unrecognised #pragma arguments '%s' This #pragma directive has been
                                                                                                               ignored.
                                             The argument to a '#pragma' is unrecognised. This is hardly surprising as '#pragma's are completely
                                             implementation defined. No two implementations need support any or all of each others #pragmas.
                                             If you don't have a good reason for using this directive then avoid it - it will only give you problems later.
                                             MISRA Rule 100: The defined pre-processor operator shall only be used in one of the two standard forms.
                                             Example Code:
#include "misra.h"
#define ID
                                             #if !defined ID
                                             #endif
                                             #if defined(ABCD)
                                             #endif
                                             #endif
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             {
                                             }
The unary operator expression 'defined' expects an identifier argument where none was given.
                                             ...
                                             #if defined()
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    170 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             ...
                                                          0888                            ISO_ExpU          [U] 'defined' requires an identifier as an argument.
                                             'defined' requires an identifier as an argument. Not providing an identifier argument is a syntax error. For
                                             example:
                                             #if defined (%) /* Illegal use of 'defined' */
                                             #endif
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                                                    {
                                                                                    S32 i = 1;
                                                                                    p = &i;                        /* MISRA Violation */
                                                                    }
                                                 {
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                                     int b;
This document and the information ..............................................
                                                     a = &b;
                                                 }
inventions, are reserved by VDOTransmittal, reproduction,
                                                          3217                             Maj_Ops            The address of a local variable is being assigned to a static variable which
                                                                                                              persists when the memory for the local variable is freed.
model or design patent are reserved.
                                             Assigning the address of a local variable to a static variable is dangerous, since once the local variable goes out
                                             of scope, the address the static variable points to is invalid. For example:
                                                                                                                                     Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                          2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                                 Status
                                                                                                                                                                                                 released
                                                                                                     Documentkey                                                                                 Pages
                                                                                                                                                                                                 171 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             void f(void)
                                             {
                                                 static int* v;
                                                 int a;
                                                 v = &a; /* Can I always access 'a' through '*v' ? */
                                                 /* NO! The address of 'a' could change across function calls */
                                             }
#include "misra.h"
                                             struct stag { };
This document and the information ..............................................
                                                                    return 1;
                                             }
model or design patent are reserved.
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                172 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                          0545                            ISO_ExpU            [U] The value of an incomplete 'struct' may not be used.
                                             An incomplete struct is a struct declaration with no body part defined. Objects may be declared of incomplete
                                             struct type but the value of such an object cannot subsequently be used. For example:
                                             void fn(void)
                                             {
                                                 extern struct John john;
                                                 int                j = john;
                                             }
                                                          0623                            ISO_ExpU            [U] '%s' has incomplete type and no linkage - this is undefined.
                                             Identifiers declared to be function parameters, and block scope identifiers without an explicit 'extern' storage-
                                             class specifier all have no linkage. These identifiers must not be declared to be of an incomplete type.
                                             Array types of unknown size, structure or union types of unknown content, and the type void are all incomplete
                                             types.
                                             This message is produced when an identifier with incomplete type occurs without linkage. For example:
                                             {
                                                                    struct record field;
                                                                    /* ... */
                                             }
                                             In the above example there has been no definition of the 'record' structure so the declaration of 'field' is
                                             incomplete. As the declaration appears in block scope it therefore has no linkage.
                                             Maybe you are missing include files or you have misspelled the identifier.
                                                          0636                            ISO_ExpU            [U] There are no named members in this 'struct' or 'union'.
                                             A struct should consist of named members. e.g.
                                             struct b
                                             {
                                             };
                                             No members in this struct.
                                                          3310                             Maj_array          No definition has yet been given for structure tag '%s'.
dissemination and/or editing of this document as well as utilization of its
                                             The identifier tag that you are using to declare this structure has not been defined. This is dangerous but not
damages. All rights created by patent grant or registration of a utility
This document and the information ..............................................
                                             illegal. It may have been defined in a header file that should be '#include'd in this file. For example:
contents and communication there of to others without express
                                                          3313                             Maj_array          No definition has been found for structure tag '%s'.
                                             This structure tag has been used but has not been defined anywhere. Perhaps a header file should be included.
                                             For example:
model or design patent are reserved.
                                                                                                                                       Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                  Status
                                                                                                                                                                                                    released
                                                                                                       Documentkey                                                                                  Pages
                                                                                                                                                                                                    173 of 181
                                                   Siemens VDO Automotive AG                                                                                      Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             MISRA Rule 110: Unions shall not be used to access the sub-parts of larger data types.
                                             This rule requires simply that unions shall not be used. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
                                             union test
                                             {
                                                 S8 *c;
                                                 S32 i;
                                             };
                                                                    return(0);
                                             }
                                                       5110                         MISRA_Rule_110_Req_ Unions shall not be used to access the sub-parts of larger data types.
dissemination and/or editing of this document as well as utilization of its
                                             MISRA Rule 113: All the members of a structure (or union) shall be named and shall only be accessed via
This document and the information ..............................................
                                             their name.
inventions, are reserved by VDOTransmittal, reproduction,
                                             The ISO standard permits the declaration of unnamed bit-fields in order to facilitate padding. They can't be
                                             accessed by normal methods.
                                             MISRA stipulates that this feature should not be used. QAC will issue a warning if any bit-field is declared without
                                             a name. Example Code:
                                             #include "misra.h"
model or design patent are reserved.
                                             struct bitest
                                             {
                                                     UBITFIELD b1: 3;
                                                     UBITFIELD b2: 11;
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                              Status
                                                                                                                                                                                                released
                                                                                                       Documentkey                                                                              Pages
                                                                                                                                                                                                174 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             struct at
                                             {
                                                 int n;
                                                 struct sid;                                                                   /* Unnamed structure - Message 0660 */
                                             } atx;
                                             A number of compilers allow the programmer to access the elements of the unnamed structure in the example
                                             above using the constructs "atx.a" and "atx.b". However this is an extension to the ISO C language and should be
                                             avoided in the interests of portability. QA C will recognise the construct and generate message 662.
                                             3.2.17 Standard Libraries, Misra-Rules: 114, 115, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
                                             MISRA Rule 114: Reserved words and standard library function names shall not be redefined or
                                             undefined.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
#include "misra.h"
S32 _anything = 1;
                                                                                                                                       Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                            2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                       Designation                                                                                 Status
                                                                                                                                                                                                   released
                                                                                                       Documentkey                                                                                 Pages
                                                                                                                                                                                                   175 of 181
                                                   Siemens VDO Automotive AG                                                                                     Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                    ++_anything;
                                                                    return(0);
                                             }
                                                       0848                             ISO_ExpU       [U] Use of '#undef' to remove '%s' which is predefined by the compiler.
                                             You have attempted to undefine one of the pre-defined macro names. e.g.
                                             #undef __STDC__            /* illegal */
                                             Pre-defined macro names which cannot be undefined include '__LINE__', '__FILE__', '__DATE__', '__TIME__'
                                             and '__STDC__'.
                                             In addition you cannot redefine these macro names using a '#define' directive.
                                             Note that this message is not generated for attempts to undefine the `defined' macro - this generates message
                                             837 instead.
                                                 5114 MISRA_Rule_114_Req_ Reserved words and standard library function names shall not be redefined or
                                                                          undefined.
                                             MISRA Rule 115: Standard library function names shall not be reused.
                                             Identifiers prefixed with '_' are reserved for library use. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
dissemination and/or editing of this document as well as utilization of its
                                             #include "misra.h"
The user is not allowed to disclose it to third parties without having the
Document, in so far as it is based on VDO authorship, are and remain
the property of VDO. This document and ll information is confidential.
                                             extern S8 printf[81];
inventions, are reserved by VDOTransmittal, reproduction,
                                                                    r = sqrt( r );
                                                                    printf[0] = 'A';
                                                                    printf[1] = '\0';
return(0);
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               176 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                  0602                              ISO_ExpU     [U] The identifier '%s' is reserved for use by the library.
                                             This identifier is a reserved identifier and should not be used here. e.g.
                                             int
                                             main (void)
                                             {
                                               int __sigDefault;                /* warning 0602:                 */
                                               int __sigIgnore;                 /* prefix '__' reserved */
                                               int __sigError;                  /* for library use               */
                                               int _sigIgnore;                  /* OK */
                                               return 1;
                                             }
                                             MISRA Rule 118: Dynamic heap memory allocation shall not be used.
                                             This rule is implemented through the use of the warncall feature of QAC. Any call to the functions malloc, calloc,
                                             free, or realloc will be identified with message 5118.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include <stdlib.h>
                                             #include "misra.h"
#define L 4
                                                 return(0);
                                             }
                                             QAC-rule: 5115
                                                       5118                         MISRA_Rule_118_Req_ Dynamic heap memory allocation shall not be used.
model or design patent are reserved.
                                             MISRA Rule 119: The error indicator errno shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                                                                                                                    Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                                Status
                                                                                                                                                                                                 released
                                                                                                      Documentkey                                                                                Pages
                                                                                                                                                                                                 177 of 181
                                                   Siemens VDO Automotive AG                                                                                   Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             #include <errno.h>
                                             #include "misra.h"
                                                                      return(r);
                                             }
                                             QAC-Rule: 5119
                                                       5119                         MISRA_Rule_119_Req_ The error indicator errno shall not be used.
                                             MISRA Rule 120: The macro offsetof, in library <stddef.h>, shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include <stddef.h>
                                             #include "misra.h"
                                                                    s.a = 1;
                                                                    s.b = 0.0;
                                                                    return(0);
dissemination and/or editing of this document as well as utilization of its
                                             }
damages. All rights created by patent grant or registration of a utility
                                             QAC-Rule: 5120
This document and the information ..............................................
                                                       5120                         MISRA_Rule_120_Req_ The macro offsetof, in library <stddef.h>, shall not be used.
                                             MISRA Rule 121: <locale.h> and the setlocale function shall not be used.
                                             Use of setlocale is detected using the warncall feature in QAC. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
model or design patent are reserved.
                                                                                                                                  Date          Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                       2003-03-12    SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                               Status
                                                                                                                                                                                               released
                                                                                                     Documentkey                                                                               Pages
                                                                                                                                                                                               178 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                                                      return(0);
                                             }
                                             QAC-Rule 5121
                                                       5121                         MISRA_Rule_121_Req_ <locale.h> and the setlocale function shall not be used.
                                             MISRA Rule 122: The setjmp macro and the longjmp function shall not be used.
                                             Use of longjmp is detected using the warncall feature in QAC. setjmp is captured in post-processing.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include                                          <stddef.h>
                                             #include                                          <setjmp.h>
#include "misra.h"
                                                                      return(0);
                                             }
                                             QAC-Rule 5122
                                                       5122                         MISRA_Rule_122_Req_ The setjmp macro and the longjmp function shall not be used.
MISRA Rule 123: The signal handling facilities of <signal.h> shall not be used
                                             Example Code:
dissemination and/or editing of this document as well as utilization of its
#include "misra.h"
                                                                    return(i);
                                             }
                                                                                                                                 Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                      2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                     Designation                                                                             Status
                                                                                                                                                                                             released
                                                                                                     Documentkey                                                                             Pages
                                                                                                                                                                                             179 of 181
                                                   Siemens VDO Automotive AG                                                                               Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             QAC-Rule: 5123
                                                       5123                         MISRA_Rule_123_Req_ The signal handling facilities of <signal.h> shall not be used
MISRA Rule 124: The input/output library <stdio.h> shall not be used in production code.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                                                    return(0);
                                             }
                                             QAC-Rule 5124
                                                       5124                         MISRA_Rule_124_Req_ The input/output library <stdio.h> shall not be used in production code.
                                             MISRA Rule 125: The library functions atof(), atoi() and atol() from library <stdlib.h> shall not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include <stdlib.h>
                                             #include "misra.h"
                                                                    return(0);
                                             }
                                             QAC-Rule 5125
dissemination and/or editing of this document as well as utilization of its
                                                       5125                         MISRA_Rule_125_Req_ The library functions atof(), atoi() and atol() from library <stdlib.h> shall not be
damages. All rights created by patent grant or registration of a utility
                                                                                                        used.
This document and the information ..............................................
                                             MISRA Rule 126: The library functions abort(), exit(), getenv() and system() from library <stdlib.h> shall
                                             not be used.
                                             Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
model or design patent are reserved.
                                             #include <stdlib.h>
                                             #include "misra.h"
                                                                                                                                   Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                        2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                              Status
                                                                                                                                                                                               released
                                                                                                      Documentkey                                                                              Pages
                                                                                                                                                                                               180 of 181
                                                   Siemens VDO Automotive AG                                                                                 Copyright ( C ) Siemens AG 2003        A4 : 2003-02
                                             HVAC Programming Guideline
                                             {
                                                                    S32                      i = 0;
                                                                    PC                      *v;
                                                                    if (arg < 3)
                                                                    {
                                                                        abort();                                    /* MISRA Violation */
                                                                    }
                                                                    if (arg == 4)
                                                                    {
                                                                        exit(1);                                    /* MISRA Violation */
                                                                    }
                                             QAC-Rule 5126
                                                       5126                         MISRA_Rule_126_Req_ The library functions abort(), exit(), getenv() and system() from library
                                                                                                        <stdlib.h> shall not be used.
                                             MISRA Rule 127: The time handling functions of library <time.h> shall not be used.
                                             Use of the time.h functions is detected using the warncall feature in QAC. Example Code:
                                             #pragma PRQA_MESSAGES_OFF 3408
                                             #include <stdlib.h>
                                             #include <time.h>                                                              /* MISRA Violation */
                                             #include "misra.h"
                                                                    return (0);
                                             }
                                             QAC-Rule 5127
                                                       5127                         MISRA_Rule_127_Req_ The time handling functions of library <time.h> shall not be used.
dissemination and/or editing of this document as well as utilization of its
                                             QAC 4700
inventions, are reserved by VDOTransmittal, reproduction,
                                                                                                                                    Date         Department
                                             Designed by
                                                                                   Sofian.limoa@siemens.com                         2003-03-12   SV I IP HVAC TA SW
                                             Released by
                                                                                                      Designation                                                                               Status
                                                                                                                                                                                                released
                                                                                                      Documentkey                                                                               Pages
                                                                                                                                                                                                181 of 181
                                                   Siemens VDO Automotive AG                                                                                  Copyright ( C ) Siemens AG 2003        A4 : 2003-02