Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2004-8.8_a

In this section:
Synopsis

(Required) An external object or function shall be declared once in one and only one file.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Multiple declarations of the same external object or function were found. This check is identical to MISRAC2012-Rule-8.5_a, MISRAC++2008-3-2-3_a.

Coding standards
MISRA C:2012 Rule-8.5

(Required) An external object or function shall be declared once in one and only one file

MISRA C++ 2008 3-2-3

(Required) A type, object or function that is used in multiple translation units shall be declared in one and only one file.

Code examples

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

extern int x;
extern int x;
int x = 1;

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

extern int x;
int x = 1;