AutosarC++17_03-M5.0.4

An implicit integral conversion shall not change the signedness of the underlying type

Required inputs: IR

Rationale

Some signed to unsigned conversions may lead to implementation-defined behaviour. This behaviour may not be consistent with developer expectations.

Example
void f() 
{
int8_t s8;
uint8_t u8; s8 = u8; // Non-compliant
u8 = s8 + u8; // Non-compliant
u8 = static_cast< uint8_t > ( s8 ) + u8; // Compliant
}

Note

For legal reasons, this rule’s description is not part of the public documentation.