C99 中的哪一节说数组在 C 中没有复制地传递给函数?
Which § in C99 says that an array is passed to a function without copy in C?
我最近注意到
void foo(int array[10]);
调用foo
时不加载数组内容的堆栈,所以声明等同于:
void foo(int *array):
我想在 C99 标准中找到断言此行为的部分,但我没有找到任何内容,或者我不知道应该搜索什么。到目前为止,我尝试了 by reference
、by value
、function call
、passing arguments
、...
C11 6.7.6.3 §7。 (C99 6.7.5.3 §7)
A declaration of a parameter as ‘‘array of type’’ shall be adjusted to
‘‘qualified pointer to type’’, where the type qualifiers (if any) are
those specified within the [ and ] of the array type derivation.
术语正式命名为"array adjustment"。在 C 标准之外非正式地,它通常被称为 "array decay".
我最近注意到
void foo(int array[10]);
调用foo
时不加载数组内容的堆栈,所以声明等同于:
void foo(int *array):
我想在 C99 标准中找到断言此行为的部分,但我没有找到任何内容,或者我不知道应该搜索什么。到目前为止,我尝试了 by reference
、by value
、function call
、passing arguments
、...
C11 6.7.6.3 §7。 (C99 6.7.5.3 §7)
A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation.
术语正式命名为"array adjustment"。在 C 标准之外非正式地,它通常被称为 "array decay".