Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC++2008-5-0-4

In this section:
Synopsis

(Required) An implicit integral conversion shall not change the signedness of the underlying type.

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 
}