版本1和2间的区别
于2006-06-20 20:13:11修订的的版本1
大小: 1329
编辑: czk
备注:
于2007-07-18 19:47:53修订的的版本2
大小: 1409
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 1: 行号 1:
## page was renamed from Functions and Program Structure/4.11.1 File Inclusion

Navigation(slides)

4.11.1 File Inclusion

File inclusion makes it easy to handle collections of #defines and declarations (among other things). Any source line of the form

   #include "filename"

or

   #include <filename>

is replaced by the contents of the file filename. If the filename is quoted, searching for the file typically begins where the source program was found; if it is not found there, or if the name is enclosed in < and >, searching follows an implementation-defined rule to find the file. An included file may itself contain #include lines.

There are often several #include lines at the beginning of a source file, to include common #define statements and extern declarations, or to access the function prototype declarations for library functions from headers like <stdio.h>. (Strictly speaking, these need not be files; the details of how headers are accessed are implementation-dependent.)

#include is the preferred way to tie the declarations together for a large program. It guarantees that all the source files will be supplied with the same definitions and variable declarations, and thus eliminates a particularly nasty kind of bug. Naturally, when an included file is changed, all files that depend on it must be recompiled.

Navigation(siblings)

TCPL/4.11.1_File_Inclusion (2008-02-23 15:35:08由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.