Versions Compared

Key

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

An identifier declared in different scopes or multiple times within the same scope can be made to refer to the same object or function by linkage. An identifier can be classified as externally linked, internally linked, or not linked. These three kinds of linkage have the following characteristics [Kirch-Prinz 2002]:

  • External linkage. An identifier with external linkage represents the same object or function throughout the entire program, that is, in all compilation units and libraries belonging to the program. The identifier is available to the linker. When a second declaration of the same identifier with external linkage occurs, the linker associates the identifier with the same object or function.

...

Use of an identifier (within one translation unit) classified as both internally and externally linked causes undefined behavior. See also undefined behavior 8  of Appendix J. A translation unit includes the source file together with its headers and all source files included via the preprocessing directive #include.

...

Tool

Version

Checker

Description

LDRA tool suite

Include Page
LDRA_V
LDRA_V

575 S

Fully implemented

Splint

Include Page
Splint_V
Splint_V

 

 

GCC

Include Page
GCC_V
GCC_V

 

 

Klocwork

Include Page
Klocwork_V
Klocwork_V

IF_DEF_IN_HEADER_DECL IF_MULTI_DECL

 

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

Related Vulnerabilities

...

ISO/IEC 9899:2011 Section 6.2.2, "Linkages of identifiers"

MISRA Rule 8.1

Bibliography

[Banahan 2003] Section 8.2, "Declarations, definitions and accessibility"
[Kirch-Prinz 2002]

...