4.4.4 内部连接和外部连接(Internal Linkage and External Linkage)
在这一小节中,我们来讨论一下C语言的内部连接Interal Linkage和外部连接External Linkage。C标准中关于连接Linkage的原文为:
An identifier declared in different scopes or in the same scope more than once can be made
to refer to the same object or function by a process called linkage . There are three kinds of linkage: external, internal, and none.
其大意为:出现在不同作用域或者相同作用域的多个重名声明,它们可代表内存中的同一个对象,而把多个重名声明对应到同一内存对象的过程称为连接Linkage,可分有外部连接ExternalLinkage、内部连接Internal Linkage和无连接None of Linkage。此处我们讨论的连接Linkage主要是针对重名的多个外部声明而言,而不是“连接器Linker所做的把多个编译后生成目标文件连接Linking成一个可执行程序”的工作。在英文的语境中,这两者分别对应的单词为Linkage和Linking,但在中文的语境中,都被