Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2012-Rule-7.6

In this section:
Synopsis

(Required) The small integer variants of the minimum-width integer constant macros shall not be used.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

Small integer constant macro found.

Coding standards
MISRA C:2012 Rule-7.6

(Required) The small integer variants Of the minimum-width integer constant macros shall not be used

Code examples

The following code example fails the check and will give a warning:

#include <stdint.h>

void example( void ) { 
  uint8_t a = UINT8_C( 100 ); /* Non-compliant - typically expands as plain 100 i.e. as a signed int */
}

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

#include <stdint.h>

void example( void ) { 
  uint32_t a = UINT32_C( 100 ); /* Compliant, not small */
}