Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2023-7.0.5

In this section:
Synopsis

(Required) Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

One or more implicit integral conversions have been found that change the signedness 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()
{
  int8_t s8;
  uint8_t u8;
  s8 = u8; // Non-compliant
}

The following code example passes the check and will not give a warning about this issue:

#include <stdint.h>
void f()
{
  int8_t s8;
  uint8_t u8;
  u8 = static_cast< uint8_t > ( s8 ) + u8; // Compliant 
}