MISRAC++2008-5-0-3
In this section:
Synopsis
(Required) A cvalue expression shall not be implicitly converted to a different underlying type.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
One or more cvalue expressions have been implicitly converted to a different underlying type.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
#include <stdint.h>
void f ( )
{
int32_t s32;
int8_t s8;
s32 = s8 + s8; // Example 1 – Non-compliant
// The addition operation is performed with an underlying type of int8_t and the result
// is converted to an underlying type of int32_t.
}
The following code example passes the check and will not give a warning about this issue:
#include <stdint.h>
void f ( )
{
int32_t s32;
int8_t s8;
s32 = static_cast < int32_t > ( s8 ) + s8; // Example 2 - Compliant
// the addition is performed with an underlying type of int32_t and therefore
// no underlying type conversion is required.
}