Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-21.22

In this section:
Synopsis

(Mandatory) All operand arguments to any type-generic macros declared in <tgmath.h> shall have an appropriate essential type.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Uses of bad type argument to tgmath.h macro were found.

Coding standards
MISRA C:2012 Rule-21.22

(Mandatory) All operand arguments to any type-generic macros declared in <tgmath.h> shall have an appropriate essential type

Code examples

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

#include <tgmath.h>
char c1, c2;

void example (void)
{
  c2 = sqrt (c1); /* Non-compliant - essentially character real type */
}

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

#include <tgmath.h>

float f1, f2;

void example (void)
{
  f2 = sqrt (f1); /* Compliant - essentially floating real type */
}