21-05-2008, 08:33 AM
One of the models used to establish effectively boolean in MISRA-C:2004 requires consistent use of a variable's type.
Line 41:
This first use of variable mc2_1206_x establishes this to be an integer type. Therefore the boolean assignment on line 76 is inconsistent with line 41. However, this is not explicitly covered in the modified rule text (TC1).
This is an advisory rule.
Tools may or may not flag this as compliant depending on the model of boolean type used. Consistent use of a single model of "boolean" is preferred in your project.
With the introduction of a boolean type in C99, the next version of MISRA-C will use this boolean type model.
Line 41:
Code:
mc2_1206_x = get_uint16 ( );
This first use of variable mc2_1206_x establishes this to be an integer type. Therefore the boolean assignment on line 76 is inconsistent with line 41. However, this is not explicitly covered in the modified rule text (TC1).
This is an advisory rule.
Tools may or may not flag this as compliant depending on the model of boolean type used. Consistent use of a single model of "boolean" is preferred in your project.
With the introduction of a boolean type in C99, the next version of MISRA-C will use this boolean type model.
Posted by and on behalf of the MISRA C Working Group