有人能解释一下为什么 C 中的 #include 指令允许包含“.h”文件以外的文件吗
can someone explain me why the #include directive in C allows to include files other that ".h" files
谁能给我解释一下为什么要写这样的东西:
#include "file.txt"
#include "File.js" /* why including files other than files with .h extension is valid */
#include "anotherFile.c"
main()
{
printf("why including files other than header files (.h files) is allowed in C");
}
所以有人可以为我提供一个很好的在线教程来描述这个。当我在网上搜索这个时,我一无所获。 #include directive
的这种行为是否在 C standard pdf or C standard html 的某处描述过,如果是,请引导我到 C standard
中描述这种行为的实际页面,并带有 link
include 指令是 C 预处理器的一部分。预处理器将简单地用引用文件的内容替换包含。
参见 6.10.2 源文件包含:
A preprocessing directive of the form
#include "q-char-sequence" new-line
causes the replacement of that directive by the entire contents of the source file identified by the
specified sequence between the " delimiters.
谁能给我解释一下为什么要写这样的东西:
#include "file.txt"
#include "File.js" /* why including files other than files with .h extension is valid */
#include "anotherFile.c"
main()
{
printf("why including files other than header files (.h files) is allowed in C");
}
所以有人可以为我提供一个很好的在线教程来描述这个。当我在网上搜索这个时,我一无所获。 #include directive
的这种行为是否在 C standard pdf or C standard html 的某处描述过,如果是,请引导我到 C standard
中描述这种行为的实际页面,并带有 link
include 指令是 C 预处理器的一部分。预处理器将简单地用引用文件的内容替换包含。 参见 6.10.2 源文件包含:
A preprocessing directive of the form
#include "q-char-sequence" new-line
causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the " delimiters.