nginx 源码头文件包含为什么是 < >, 而不是" "

在看nginx 源码是看到头文件包含都是 使用 #include <ngx_core.h> #include <nginx.h> 类似格式, 在 IDE 中会报错找不到文件
这些文件不是在系统目录里,为什么要使用 "<>"

阅读 2.8k
1 个回答

以下节选自ISO/IEC 9899:1999原文:

# include <h-char-sequence> new-line
searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header.

How the places are specified or the header identified is implementation-defined.

注意到最后了吗,implementation-defined——没人规定说就是系统目录,而且很多编译器的默认行为也不是仅查找系统目录。即使是同一种编译器,具体的行为尚且可能取决于你提供的选项呢,何况C语言编译器五花八门。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题