Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider $version (sch jbop) (X_X)@==(Q_Q)@

Wiki Markup
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 02|AA. C References#Kirch-Prinz 02]\]:

...

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

...

Noncompliant Code Example

In this non-compliant noncompliant code example, i2 and i5 are defined as having both internal and external linkage. Future use of either identifier results in undefined behavior.

...

Both Microsoft Visual Studio 2003 and Microsoft Visual Studio 2005 compile this non-compliant noncompliant code example without warning even at the highest diagnostic levels. Microsoft Visual Studio 2008 does provide warnings at the default warning level. The GCC compiler generates a fatal diagnostic for the conflicting definitions of i2 and i5.

...

Wiki Markup
\[[Banahan 03|AA. C References#Banahan 03]\] [Section 8.2, "Declarations, Definitions and Accessibility"|http://publications.gbdirect.co.uk/c_book/chapter8/declarations_and_definitions.html]
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.2.2, "Linkages of identifiers"
\[[Kirch-Prinz 02|AA. C References#Kirch-Prinz 02]\]
\[[MISRA 04|AA. C References#MISRA 04]\] Rule 8.1

...