Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

1st \ 2nd

static

none

extern

static

internalInternal

undefinedUndefined

internalInternal

none

undefinedUndefined

externalExternalexternal

External

extern

undefinedUndefined

externalExternalexternal

External

Noncompliant Code Example

...

Microsoft Visual Studio 2008 and later provide warnings for this code at the default warning level (/W3), however but earlier versions do not warn even at the highest diagnostic levels. The GCC compiler generates a fatal diagnostic for the conflicting definitions of i2 and i5.

...

This compliant solution does not include conflicting definitions.:

Code Block
bgColor#ccccff
langc
int i1 = 10;  /* definition, external linkage */
static int i2 = 20;  /* definition, internal linkage */
extern int i3 = 30;  /* definition, external linkage */
int i4;  /* tentative definition, external linkage */
static int i5;  /* tentative definition, internal linkage */

int main(void) {
  /* ... */
}

...

include

Tool

Version

Checker

Description

GCC

GCC_VGCC_V

 

 

Coverity6.5LINKAGE_CONFLICTFully implemented

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

intllnkg

Fully implemented

GCC

Include Page
GCC_V
GCC_V

 

 

Klocwork

Include Page
Klocwork_V
Klocwork_V

IF_DEF_IN_HEADER_DECL IF_MULTI_DECL

 

LDRA tool suite

Include Page
LDRA_V
LDRA_V

575 S

Fully implemented

Splint

Include Page
Splint_V
Splint_V

 

 

PRQA QA-C
Include Page
PRQA_V
PRQA_V
0625 (U)Fully implemented

...

Bibliography

...