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

浏览:39日期:2022-07-16

问题描述

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

问题解答

回答1:

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

# include <h-char-sequence> new-linesearches 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语言编译器五花八门。

相关文章: