Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-21.23

In this section:
Synopsis

(Required) All operand arguments to any multi-argument type-generic macros declared in <tgmath.h> shall have the same standard type.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Uses of differently typed arguments to tgmath.h macro were found.

Coding standards
MISRA C:2012 Rule-21.23

(Required) All operand arguments to any multi-argument type-generic macros declared in <tgmath.h> shall have the same standard type

Code examples

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

#include <tgmath.h>

void example (void) {
  float f1, f2;
  /* Non-compliant - unclear which argument was intended to control precision */
  f2 = pow(f1, d2);
}

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

#include <tgmath.h>

void example (void) {
  float f1, f2;

  f2 = pow(f1, f2); /* Compliant */
}