在The Ten Commandments for C Programmers , 你对 9th commandment 的解释是什么? ?
第九诫:
Thy external identifiers shall be unique in the first six characters, though this harsh discipline be irksome and the years of its necessity stretch before thee seemingly without end, lest thou tear thy hair out and go mad on that fateful day when thou desirest to make thy program run on an old system.
这到底是怎么回事?
最佳答案
旧的链接器只使用了有限数量的符号字符——我似乎记得我开始编程的旧 IBM 大型机只使用了 8 个字符。 C 标准人们将 6 个字符定为“最小公分母”,但如果他们愿意,将允许链接器解析更长的名称。
如果您真的点击了这些最低公分母链接器之一,外部符号(函数名称、外部变量等)ABCDEFG 和 ABCDEFH 对它们来说将是相同的。除非您在非常旧的硬件上编程,否则您可以安全地忽略这条“命令”。
请注意,任何不能处理超过 6 个字符的链接器都不能执行 C++,因为名称重整。
关于c - 第九条诫命是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/682719/