Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2008-3-2-1

In this section:
Synopsis

(Required) All declarations of an object or function shall have compatible types.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

An extern definition is missing a compatible declaration. This check is identical to MISRAC2012-Rule-8.4.

Coding standards
MISRA C:2012 Rule-8.4

(Required) A compatible declaration shall be visible when an object or function with external linkage is defined

Code examples

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

extern int x = 1;

char c = 'c';

void foo (void) {}

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

extern int x;
     
int x = 0;

extern void foo (void);

void foo (void) {}

static void bar1 (void){}

static void bar2 (void);

void bar2 (void) {}