stdarg.h在哪里?

sid*_*yll 10 c macos gcc freebsd libc

在我的系统上(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
Run Code Online (Sandbox Code Playgroud)

那么,如果GCC使用自己的stdarg.h副本,它在哪里呢?我不知道这#include_next意味着什么(可能是GCC扩展?),也不知道"MWERKS"(编译器?).

Ste*_*non 6

<stdarg.h>,甚至超过大多数C库头文件,往往是特定于编译器的.因此,OS X上的每个编译器都有自己的stdarg.h实现,可以在特定于编译器的位置找到(它包含在该编译器的默认搜索路径中).编译器找到泛型stdarg.h,它基本上告诉它"继续查找"(通过扩展#include_next),然后它找到编译器特定的实现.

__MWERKS__ 是指PPC的旧编译器,"MetroWerks CodeWarrior".