MISRAC++2008-5-0-6 (C++ only)
In this section:
Synopsis
(Required) An implicit integral or floating-point conversion shall not reduce the size of the underlying type.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
One or more implicit integral or floating-point conversion were found that reduce the size of the 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;
int16_t s16;
s16 = s32; // Non-compliant
}
The following code example passes the check and will not give a warning about this issue:
#include <stdint.h>
void f ( )
{
int32_t s32;
int16_t s16;
s16 = static_cast< int16_t > ( s32 ); // Compliant
}