我在 C11 标准中搜索可变参数函数的描述,但我找到的唯一信息几乎没有提到这个主题。谁能告诉我可以在其中找到关于他们的所有主题的引用资料?
到目前为止,我发现自己在 §6.9.1.8 中:
If a function that accepts a variable number of arguments is defined without a parameter type list that ends with the ellipsis notation, the behavior is undefined.
在 §7.16 中描述了 <stdarg.h>
头文件。但是,我非常怀疑这是关于标准中可变参数函数的所有信息。
最佳答案
除了您指出的章节之外,我还建议您查看 C11
标准的第 6.7.6.3 章,其中包含有关函数声明符的更多信息。总结一下,
- 可变函数声明:章节 §6.7.6.3
- 可变函数调用:章节 §6.5.2.2
- 可变函数定义:章节 §6.9.1
- Variadic function argument list related macros and their usage: Chapter §7.16.1.1 - §7.16.1.4
但是,在标准本身 AFAIK 中,没有以完整章节(如果您正在寻找的话)的形式编译的可变参数函数的完整描述。
您可能想看看 wiki entry以获得更多见解。
关于c - 在哪里描述了 C 标准可变参数函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34577745/