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 <stdarg.h>
#elif defined(__MWERKS__)
#include "mw_stdarg.h"
#else
#error "This header only supports __MWERKS__."
#endif
那么,如果 GCC 使用它自己的 stdarg.h 副本,它在哪里?我不知道是什么 #include_next
的意思是(也许是 GCC 扩展?),也不是关于 “MWERKS”(编译器?)。
On my system (Mac OS 10.6) /usr/include/stdarg.h is:
/* 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
So, if GCC uses its own copy of stdarg.h, where is it? I have no idea on what
that #include_next
means (maybe a GCC extension?), nor something about
"MWERKS" (a compiler?).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
甚至比大多数 C 库头文件更倾向于特定于编译器。因此,OS X 上的每个编译器都有自己的stdarg.h
实现,可以在特定于编译器的位置找到(作为该编译器默认搜索路径的一部分)。编译器找到通用的stdarg.h,它基本上告诉它“继续寻找”(通过扩展#include_next),然后找到特定于编译器的实现。__MWERKS__
指的是 PPC 的旧编译器“MetroWerks CodeWarrior”。<stdarg.h>
, even more than most C library headers, tends to be very compiler-specific. As such, each of the compilers on OS X has it's ownstdarg.h
implementation, found in a compiler-specific location (which is included as part of the default search paths for that compiler). The compiler finds the genericstdarg.h
, which basically tells it to "keep looking" (via the extension#include_next
), and it then finds the compiler-specific implementation.__MWERKS__
refers to an old compiler for PPC, "MetroWerks CodeWarrior".#include_next
是一个 gcc 扩展。您应该知道,#include
有一个搜索头文件的路径列表。 #include_next 告诉预处理器包含指定的头文件,仅检查列表中包含当前头文件的路径之后的路径。__MWERKS__
是在旧版本的 CodeWarrior 上定义的预处理器宏。#include_next
is a gcc extension. As you should know,#include
has a list of paths it searches for header files.#include_next
tells the preprocessor to include the specified header checking only paths in the list after the one that contained the current header file.__MWERKS__
is a preprocessor macro defined on old versions of CodeWarrior.