为什么使用 Storage-Class 说明符来确定两个独立的属性?

Why Storage-Class Specifiers are used to determine two independent properties?

来自 Storage-class specifiers

The storage-class specifiers determine two independent properties of the names they declare: storage duration and linkage.

因此,例如,当 static 关键字用于全局变量和函数(谁的存储 class 无论如何都是静态的)时,它会将它们的链接设置为内部链接。当用于函数内部的变量(没有链接)时 - 它将它们的存储 class 设置为静态。

我的问题是:为什么对两个事物使用同一个说明符?

原因主要是历史原因:链接是事后才想到的 C 语言设计。在早期版本中,您可以根据需要多次重新声明全局变量,链接器会为您合并所有这些声明:

Ritchie's original intention had been to model C's rules on FORTRAN COMMON declarations, on the theory that any machine that could handle FORTRAN would be ready for C. In the common-block model, a public variable may be declared multiple times; identical declarations are merged by the linker. (source)

单个声明的当前规则与 extern 关键字一起出现。那时有大量 C 代码,足以使向后兼容性变得重要。这可能就是为什么语言设计者没有引入新关键字来处理链接,而是重用 static 的原因。