Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC++2008-3-9-2

In this section:
Synopsis

(Advisory) typedefs that indicate size and signedness should be used in place of the basic numerical types.

Enabled by default

No

Severity/Certainty

Low/High

lowhigh.png
Full description

There are uses of the basic types char, int, short, long, double, and float without a typedef. This check is identical to MISRAC2004-6.3, MISRAC2012-Dir-4.6_a, MISRAC++2023-6.9.2.

Coding standards
MISRA C:2004 6.3

(Advisory) typedefs that indicate size and signedness should be used in place of the basic types.

MISRA C:2012 Dir-4.6

(Advisory) typedefs that indicate size and signedness should be used in place of the basic numerical types

MISRA C++ 2023 6.9.2

(Advisory) The names of the standard signed integer types and standard unsigned integer types should not be used

Code examples

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

typedef signed char SCHAR;
typedef int INT;
typedef float FLOAT;

INT func(FLOAT f, INT *pi)
{
  INT x;
  INT (*fp)(const unsigned char *);
}

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

typedef signed char SCHAR;
typedef int INT;
typedef float FLOAT;

INT func(FLOAT f, INT *pi)
{
  INT x;
  INT (*fp)(const SCHAR *);
}