• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/cpp/
1<html lang="en">
2<head>
3<title>Header Files - The C Preprocessor</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="The C Preprocessor">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="prev" href="Overview.html#Overview" title="Overview">
9<link rel="next" href="Macros.html#Macros" title="Macros">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
142008, 2009, 2010, 2011
15Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation.  A copy of
20the license is included in the
21section entitled ``GNU Free Documentation License''.
22
23This manual contains no Invariant Sections.  The Front-Cover Texts are
24(a) (see below), and the Back-Cover Texts are (b) (see below).
25
26(a) The FSF's Front-Cover Text is:
27
28     A GNU Manual
29
30(b) The FSF's Back-Cover Text is:
31
32     You have freedom to copy and modify this GNU Manual, like GNU
33     software.  Copies published by the Free Software Foundation raise
34     funds for GNU development.
35-->
36<meta http-equiv="Content-Style-Type" content="text/css">
37<style type="text/css"><!--
38  pre.display { font-family:inherit }
39  pre.format  { font-family:inherit }
40  pre.smalldisplay { font-family:inherit; font-size:smaller }
41  pre.smallformat  { font-family:inherit; font-size:smaller }
42  pre.smallexample { font-size:smaller }
43  pre.smalllisp    { font-size:smaller }
44  span.sc    { font-variant:small-caps }
45  span.roman { font-family:serif; font-weight:normal; } 
46  span.sansserif { font-family:sans-serif; font-weight:normal; } 
47--></style>
48<link rel="stylesheet" type="text/css" href="../cs.css">
49</head>
50<body>
51<div class="node">
52<a name="Header-Files"></a>
53<p>
54Next:&nbsp;<a rel="next" accesskey="n" href="Macros.html#Macros">Macros</a>,
55Previous:&nbsp;<a rel="previous" accesskey="p" href="Overview.html#Overview">Overview</a>,
56Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
57<hr>
58</div>
59
60<h2 class="chapter">2 Header Files</h2>
61
62<p><a name="index-header-file-25"></a>A header file is a file containing C declarations and macro definitions
63(see <a href="Macros.html#Macros">Macros</a>) to be shared between several source files.  You request
64the use of a header file in your program by <dfn>including</dfn> it, with the
65C preprocessing directive &lsquo;<samp><span class="samp">#include</span></samp>&rsquo;.
66
67   <p>Header files serve two purposes.
68
69     <ul>
70<li><a name="index-system-header-files-26"></a>System header files declare the interfaces to parts of the operating
71system.  You include them in your program to supply the definitions and
72declarations you need to invoke system calls and libraries.
73
74     <li>Your own header files contain declarations for interfaces between the
75source files of your program.  Each time you have a group of related
76declarations and macro definitions all or most of which are needed in
77several different source files, it is a good idea to create a header
78file for them. 
79</ul>
80
81   <p>Including a header file produces the same results as copying the header
82file into each source file that needs it.  Such copying would be
83time-consuming and error-prone.  With a header file, the related
84declarations appear in only one place.  If they need to be changed, they
85can be changed in one place, and programs that include the header file
86will automatically use the new version when next recompiled.  The header
87file eliminates the labor of finding and changing all the copies as well
88as the risk that a failure to find one copy will result in
89inconsistencies within a program.
90
91   <p>In C, the usual convention is to give header files names that end with
92<samp><span class="file">.h</span></samp>.  It is most portable to use only letters, digits, dashes, and
93underscores in header file names, and at most one dot.
94
95<ul class="menu">
96<li><a accesskey="1" href="Include-Syntax.html#Include-Syntax">Include Syntax</a>
97<li><a accesskey="2" href="Include-Operation.html#Include-Operation">Include Operation</a>
98<li><a accesskey="3" href="Search-Path.html#Search-Path">Search Path</a>
99<li><a accesskey="4" href="Once_002dOnly-Headers.html#Once_002dOnly-Headers">Once-Only Headers</a>
100<li><a accesskey="5" href="Alternatives-to-Wrapper-_0023ifndef.html#Alternatives-to-Wrapper-_0023ifndef">Alternatives to Wrapper #ifndef</a>
101<li><a accesskey="6" href="Computed-Includes.html#Computed-Includes">Computed Includes</a>
102<li><a accesskey="7" href="Wrapper-Headers.html#Wrapper-Headers">Wrapper Headers</a>
103<li><a accesskey="8" href="System-Headers.html#System-Headers">System Headers</a>
104</ul>
105
106   </body></html>
107
108