无链接No Linkage

如果块内的某个标识符的声明不包括 extern 存储类说明符,则该标识符没有链接并且对函数是唯一的。If a declaration for an identifier within a block does not include the extern storage-class specifier, the identifier has no linkage and is unique to the function.

以下标识符没有链接:The following identifiers have no linkage:

  • 声明为除对象或函数以外的任何项的标识符An identifier declared to be anything other than an object or a function

  • 声明为函数参数的标识符An identifier declared to be a function parameter

  • 声明时未使用 extern 存储类说明符的对象的块范围标识符A block-scope identifier for an object declared without the extern storage-class specifier

    如果标识符没有链接,那么在相同的范围级别内再次声明相同的名称(在声明符或类型说明符中)将产生符号重新定义错误。If an identifier has no linkage, declaring the same name again (in a declarator or type specifier) in the same scope level generates a symbol redefinition error.

另请参阅See Also

使用 extern 指定链接Using extern to Specify Linkage