Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC2004-6.2

In this section:
Synopsis

(Required) signed and unsigned char type shall be used only for the storage and use of numeric values.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

A signed or unsigned char is used on character data.

Coding standards
CERT INT07-C

Use only explicitly signed or unsigned char type for numeric values

MISRA C:2004 6.2

(Required) signed and unsigned char type shall be used only for the storage and use of numeric values.

Code examples

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

void example(void) {
  unsigned char c = 'c';
}

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

void example(void) {
  char c = 'c';
}