08-08-2010, 07:41 PM
It is true that MISRA Rule 10.1 does not address the issue of underlying type except in the context of signed and unsigned types. The reply that you have quoted refers to the result of relational, equality and logical operations so it is important to remember that Rule 10.1 may still apply to the operands of these operators.
A future version of MISRA-C will extend the concept of underlying type so that, for example, the result of a relational, logical or equality operator (an "effectively Boolean" expression), would be considered to have a 'Boolean' underlying type.
However this does not in any way conflict with the principle enshrined in Rule 10.1 that implicit conversions shall not take place between signed and unsigned types. The operands of a binary operand in which the "usual arithmetic conversions" apply, must therefore be of the same underlying signedness. So the expression "(u16r == 1)" is not compliant , whereas "(u16r == 1u)" would be compliant.
A future version of MISRA-C will extend the concept of underlying type so that, for example, the result of a relational, logical or equality operator (an "effectively Boolean" expression), would be considered to have a 'Boolean' underlying type.
However this does not in any way conflict with the principle enshrined in Rule 10.1 that implicit conversions shall not take place between signed and unsigned types. The operands of a binary operand in which the "usual arithmetic conversions" apply, must therefore be of the same underlying signedness. So the expression "(u16r == 1)" is not compliant , whereas "(u16r == 1u)" would be compliant.
Posted by and on behalf of the MISRA C Working Group