Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2004-5.6

In this section:
Synopsis

(Advisory) No identifier in one namespace should have the same spelling as an identifier in another namespace, with the exception of structure member and union member names.

Enabled by default

No

Severity/Certainty

Low/Low

lowlow.png
Full description

Identifier reuse in different namespaces

Coding standards
MISRA C:2004 5.6

(Advisory) No identifier in one namespace should have the same spelling as an identifier in another namespace, with the exception of structure member and union member names.

Code examples

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

struct n01_tag_vs_var {
  int n02_field_vs_var;
  int n03_field_vs_func;
} n01_tag_vs_var;

int n04_var_vs_label;

int n02_field_vs_var;

void n03_field_vs_func(void) {
 n04_var_vs_label:
}

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

struct s {
  int n01_field_vs_field;
};

union u {
  int n01_field_vs_field;
  int u2;
};