Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
MISRA Essential Type Model

MISRA Essential Type Model

Jul 31 2025

Essential type model in the MISRA C standard is used to formalize rules and directives. Defining a MISRA-specific model over standard types serves the following purposes:

  • increase the strictness of type checking;
  • reduce dependence on platform- and compiler-specific type implementations;
  • establish a basic terminology for describing both explicit and implicit conversions.

According to MISRA C, the type of any expression corresponds to an essential type, as outlined in the table:

Essential type category

Standard types

Boolean essential type

_Bool

signed essential type

signed char

signed short

signed int

signed long

signed long long

enum { .... };

unsigned essential type

unsigned char

unsigned short

unsigned int

unsigned long

unsigned long long

real floating essential type

float

double

long double

complex floating essential type

_Complex float

_Complex double

_Complex long double

character essential type

char

named enum essential type

enum <name> { .... };

For example, an expression with a signed char, signed int, or any other signed type corresponds to a signed essential type.

Look at the following example:

enum FIRST {
  f1, f2, f3
};

enum SECOND {
  s1, s2, s3
};

int main()
{
  enum FIRST lhs = f1;
  enum SECOND rhs = s1;

  if (lhs == rhs)
    return 0;
  return 1;
}

The program returns 0. The variables of the enum type will be cast to int and will be equal in the comparison. However, the essential type model of enumeration considers its name. Hence, lhs and rhs will have enum<FIRST> and enum<SECOND>, respectively. According to MISRA C, comparing enumerations of different types is prohibited. This rule prevents errors and ambiguity.

Popular related articles