source: public/doc/gnu-c/Header-Files.html@ 02598c2

Last change on this file since 02598c2 was 02598c2, checked in by Mikhail Kirillov <w96k@…>, on Oct 6, 2022 at 12:36:29 PM

Add gnu-c

  • Property mode set to 100644
File size: 6.0 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 2022 Richard Stallman and Free Software Foundation, Inc.
4
5(The work of Trevis Rothwell and Nelson Beebe has been assigned or
6licensed to the FSF.)
7
8Permission is granted to copy, distribute and/or modify this document
9under the terms of the GNU Free Documentation License, Version 1.3 or
10any later version published by the Free Software Foundation; with the
11Invariant Sections being "GNU General Public License," with the
12Front-Cover Texts being "A GNU Manual," and with the Back-Cover
13Texts as in (a) below. A copy of the license is included in the
14section entitled "GNU Free Documentation License."
15
16(a) The FSF's Back-Cover Text is: "You have the freedom to copy and
17modify this GNU manual. Buying copies from the FSF supports it in
18developing GNU and promoting software freedom." -->
19<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
20<head>
21<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
22<title>Header Files (GNU C Language Manual)</title>
23
24<meta name="description" content="Header Files (GNU C Language Manual)">
25<meta name="keywords" content="Header Files (GNU C Language Manual)">
26<meta name="resource-type" content="document">
27<meta name="distribution" content="global">
28<meta name="Generator" content="makeinfo">
29<link href="index.html" rel="start" title="Top">
30<link href="Symbol-Index.html" rel="index" title="Symbol Index">
31<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
32<link href="Preprocessing.html" rel="up" title="Preprocessing">
33<link href="include-Syntax.html" rel="next" title="include Syntax">
34<link href="Preprocessing-Tokens.html" rel="prev" title="Preprocessing Tokens">
35<style type="text/css">
36<!--
37a.summary-letter {text-decoration: none}
38blockquote.indentedblock {margin-right: 0em}
39div.display {margin-left: 3.2em}
40div.example {margin-left: 3.2em}
41div.lisp {margin-left: 3.2em}
42kbd {font-style: oblique}
43pre.display {font-family: inherit}
44pre.format {font-family: inherit}
45pre.menu-comment {font-family: serif}
46pre.menu-preformatted {font-family: serif}
47span.nolinebreak {white-space: nowrap}
48span.roman {font-family: initial; font-weight: normal}
49span.sansserif {font-family: sans-serif; font-weight: normal}
50ul.no-bullet {list-style: none}
51-->
52</style>
53
54
55</head>
56
57<body lang="en">
58<span id="Header-Files"></span><div class="header">
59<p>
60Next: <a href="Macros.html" accesskey="n" rel="next">Macros</a>, Previous: <a href="Preprocessing-Tokens.html" accesskey="p" rel="prev">Preprocessing Tokens</a>, Up: <a href="Preprocessing.html" accesskey="u" rel="up">Preprocessing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Index.html" title="Index" rel="index">Index</a>]</p>
61</div>
62<hr>
63<span id="Header-Files-1"></span><h3 class="section">26.4 Header Files</h3>
64
65<span id="index-header-file"></span>
66<p>A header file is a file of C code, typically containing C declarations
67and macro definitions (see <a href="Macros.html">Macros</a>), to be shared between several
68source files. You request the use of a header file in your program by
69<em>including</em> it, with the C preprocessing directive
70<code>#include</code>.
71</p>
72<p>Header files serve two purposes.
73</p>
74<ul>
75<li> <span id="index-system-header-files"></span>
76System header files declare the interfaces to parts of the operating
77system. You include them in your program to supply the definitions and
78declarations that you need to invoke system calls and libraries.
79
80</li><li> Program-specific header files contain declarations for interfaces between the
81source files of a particular program. It is a good idea to create a header
82file for related declarations and macro definitions if all or most of them
83are needed in several different source files.
84</li></ul>
85
86<p>Including a header file produces the same results as copying the header
87file into each source file that needs it. Such copying would be
88time-consuming and error-prone. With a header file, the related
89declarations appear in only one place. If they need to be changed, you
90can change them in one place, and programs that include the header file
91will then automatically use the new version when next recompiled. The header
92file eliminates the labor of finding and changing all the copies as well
93as the risk that a failure to change one copy will result in
94inconsistencies within a program.
95</p>
96<p>In C, the usual convention is to give header files names that end with
97<samp>.h</samp>. It is most portable to use only letters, digits, dashes, and
98underscores in header file names, and at most one dot.
99</p>
100<table class="menu" border="0" cellspacing="0">
101<tr><td align="left" valign="top">&bull; <a href="include-Syntax.html" accesskey="1">include Syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
102</td></tr>
103<tr><td align="left" valign="top">&bull; <a href="include-Operation.html" accesskey="2">include Operation</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
104</td></tr>
105<tr><td align="left" valign="top">&bull; <a href="Search-Path.html" accesskey="3">Search Path</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
106</td></tr>
107<tr><td align="left" valign="top">&bull; <a href="Once_002dOnly-Headers.html" accesskey="4">Once-Only Headers</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
108</td></tr>
109<tr><td align="left" valign="top">&bull; <a href="Computed-Includes.html" accesskey="5">Computed Includes</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
110</td></tr>
111</table>
112
113<hr>
114<div class="header">
115<p>
116Next: <a href="Macros.html" accesskey="n" rel="next">Macros</a>, Previous: <a href="Preprocessing-Tokens.html" accesskey="p" rel="prev">Preprocessing Tokens</a>, Up: <a href="Preprocessing.html" accesskey="u" rel="up">Preprocessing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Index.html" title="Index" rel="index">Index</a>]</p>
117</div>
118
119
120
121</body>
122</html>
Note: See TracBrowser for help on using the repository browser.