stdarg.h在哪里?
在我的系统上(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 #elif defined(__MWERKS__) #include "mw_stdarg.h" #else #error "This header only supports __MWERKS__." #endif
那么,如果GCC使用自己的stdarg.h副本,它在哪里呢? 我不知道#include_next
意味着什么(可能是GCC扩展?),也不知道“MWERKS”(编译器?)。
,甚至比大多数C库头文件更倾向于特定于编译器。 因此,OS X上的每个编译器都有自己的stdarg.h
实现,它位于特定于编译器的位置(包含在该编译器的默认搜索路径中)。 编译器找到通用的stdarg.h
,它基本上告诉它“继续查找”(通过扩展名#include_next
),然后它找到编译器特定的实现。
__MWERKS__
指的是PPC的旧编译器,“MetroWerks CodeWarrior”。
#include_next
是gcc扩展名。 如您所知, #include
包含一个搜索头文件的路径列表。 #include_next
告诉预处理器在包含当前头文件的路径之后包含指定的头仅检查列表中的路径。
__MWERKS__
是旧版CodeWarrior上定义的预处理器宏。