局部性与更改 argc 和 argv 的名称有什么关系?

What has localness got to do with changing names of argc and argv?

这个问题可能很愚蠢。 C standard:(referred to here as argc and argv, though any names may be used, as they are local to the function in which they are declared) 变量argcargvlocalnessmain函数有什么用改名字怎么办? — 我知道它们的名称可以更改 — 我不理解标准中关于变量局部性的声明。请帮助我。

"Localness" 意味着在 "whatever" 范围内发生的事情不会影响世界其他地方。就函数参数的名称而言,这些名称不会暴露给函数外部。公开的(不同程度取决于实现和系统标准)是函数签名(又名原型)。

术语 "localness" 并非特定于 main。每个函数都有一个局部作用域。 main 也是如此。并且它的 int(char*)[] 类型的参数对于外界来说是不可见的。

What has the localness to the main function of the variables argc and argv got to do with changing their names? — I know that their names can be changed — I didn't understand the statement in the standard with respect to the localness of the variables.

我认为您只是忽略了显而易见的事实。该标准试图解决的问题是 "do I need to use the names argc and argv for the parameters of main()?" 我想我实际上已经在 SO 上看到了这个问题,尽管我无法在快速搜索中找到它。您似乎假设您当然可以根据需要命名参数,因为它们是函数参数。你所询问的条款只是肯定了这一点。

我猜您不理解阅读该标准的人可能会带来不同的印象,而且您似乎特别被标准命名 main 所迷惑。这一切都包含在以下事实中:main 是标准指定程序(与 C 实现相反)必须提供的唯一函数,并且标准为 [=13= 指定了两个特定选项] 的签名,程序员必须从中选择。如果程序要严格遵守语言规范,则不可能有任何变化。您询问的条款只是澄清使用不同的参数名称并不构成为此目的对签名进行有意义的更改。