Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2012-Rule-20.4_c99

In this section:
Synopsis

(Required) A macro shall not be defined with the same name as a keyword

Enabled by default

Yes

Severity/Certainty

Low/Low

lowlow.png
Full description

A macro was found defined with the same name as a keyword.

Coding standards
MISRA C:2012 Rule-20.4

(Required) A macro shall not be defined with the same name as a keyword

Code examples

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

/* The following example is compliant in C90, but not C99, because inline is not a keyword in C90. */

/* Remove inline if compiling for C90 */
#define inline

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

#define unless( E ) if ( ! ( E ) ) /* Compliant */