在我的系统 (Mac OS 10.6) 上 /usr/include/stdarg.h 是:
/* This file is public domain. */
/* GCC uses its own copy of this header */
#if defined(__GNUC__)
#include_next <stdarg.h>
#elif defined(__MWERKS__)
#include "mw_stdarg.h"
#else
#error "This header only supports __MWERKS__."
#endif
那么,如果 GCC 使用它自己的 stdarg.h 副本,它在哪里?我不知道什么
#include_next
意味着(也许是 GCC 扩展?),也不是关于
“MWERKS”(编译器?)。
最佳答案
<stdarg.h>
,甚至比大多数 C 库头文件更多,往往是非常特定于编译器的。因此,OS X 上的每个编译器都有自己的 stdarg.h
实现,位于特定于编译器的位置(作为该编译器的默认搜索路径的一部分包含在内)。编译器找到通用 stdarg.h
,这基本上告诉它“继续寻找”(通过扩展名 #include_next
),然后找到特定于编译器的实现。
__MWERKS__
指的是 PPC 的旧编译器“MetroWerks CodeWarrior”。
关于c - stdarg.h 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6712493/