Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (vkp)

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. References#KirchBibliography#Kirch-Prinz 02]\]:

  • 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.

...

Wiki Markup
According to C99 \[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\], linkage is determined as follows:

...

Wiki Markup
\[[Banahan 03|AA. References#BanahanBibliography#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. References#ISOBibliography#ISO/IEC 9899-1999]\] Section 6.2.2, "Linkages of identifiers"
\[[Kirch-Prinz 02|AA. References#KirchBibliography#Kirch-Prinz 02]\]
\[[MISRA 04|AA. References#MISRABibliography#MISRA 04]\] Rule 8.1

...

DCL35-C. Do not invoke a function using a type that does not match the function definition      02. Declarations and Initialization (DCL)      DCL37-C. Do not use identifiers that are reserved for the implementation