Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2004-19.5

In this section:
Synopsis

(Required) Macros shall not be #define'd or #undef'd within a block.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A #define or #undef was found inside a block.

Coding standards
MISRA C:2004 19.5

(Required) Macros shall not be #define'd or #undef'd within a block.

Code examples

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

int example() {
#define ONE 1
  return 0;
}

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

#define ONE 1
int example() {
  return 0;
}