]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man7/c99.7
build(7): Document KERNCONFDIR - directory in which KERNCONF resides
[FreeBSD/FreeBSD.git] / share / man / man7 / c99.7
1 .\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 .\" SUCH DAMAGE.
23 .\"
24 .\" $FreeBSD$
25 .\"
26 .Dd May 30, 2011
27 .Dt C 7
28 .Os
29 .Sh NAME
30 .Nm c ,
31 .Nm c78 ,
32 .Nm c89 ,
33 .Nm c90 ,
34 .Nm c99
35 .Nd The C programming language
36 .Sh DESCRIPTION
37 C is a general purpose programming language, which has a strong connection
38 with the UNIX operating system and its derivatives, since the vast
39 majority of those systems were written in the C language.
40 The C language contains some basic ideas from the BCPL language through
41 the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
42 The development of the UNIX operating system was started on a PDP-7
43 machine in assembly language, but it made very difficult to port the existing
44 code to other systems.
45 .Pp
46 In 1972 Dennis M. Ritchie worked out the C programming language for
47 further development of the UNIX operating system.
48 The idea was to implement only the C compiler for different
49 platforms, and implement most part of the operating system
50 in the new programming language to simplify the portability between
51 different architectures.
52 It follows that C is very eligible for (but not limited to) writing
53 operating systems and low-level applications.
54 .Pp
55 The C language did not have a specification or standardized version for
56 a long time.
57 It went through a lot of changes and improvements for ages.
58 In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
59 first book about C under the title "The C Programming Language".
60 We can think of this book as the first specification of the language.
61 This version is often referred as K&R C after the names of the authors.
62 Sometimes it is referred as C78, as well, after the publishing year of
63 the first edition of the book.
64 .Pp
65 It is important to notice, that the instruction set of the language is
66 limited to the most fundamental elements for simplicity.
67 Handling of the standard I/O and such common functions are implemented in
68 the libraries shipped with the compiler.
69 As these functions are also widely used, it was demanded to include into
70 the description what requisites the library should conform to, not just
71 strictly the language itself.
72 Accordingly, the aforementioned standards cover the library elements, as well.
73 The elements of this standard library is still not enough for more
74 complicated tasks.
75 In this case the provided system calls of the given operating system can be
76 used.
77 To not lose the portability by using these system calls, the POSIX
78 (Portable Operating System Interface) standard evolved.
79 It describes what functions should be available to keep portability.
80 Note, that POSIX is not a C standard, but an operating system standard
81 and thus is beyond the scope of this manual.
82 The standards discussed below are all C standards and only cover
83 the C programming language and the accompanying library.
84 .Pp
85 After the publication of the book mentioned before,
86 the American National Standards Institute (ANSI) started to work on
87 standardizing the language, and they announced ANSI X3.159-1989
88 in 1989.
89 It is usually referred as ANSI C or C89.
90 The main difference in this standard were the function prototypes,
91 which is a new way of declaring functions.
92 With the old-style function declarations, the compiler was unable to
93 check the sanity of the actual parameters at a function call.
94 The old syntax was highly error-prone because incompatible parameters
95 were hard to detect in the program code and the problem only showed up
96 at run-time.
97 .Pp
98 In 1990, the International Organization for Standardization (ISO) adopted
99 the ANSI standard as ISO/IEC 9899:1990 in 1990.
100 This is also referred as ISO C or C90.
101 It only contains negligible minor modifications against ANSI C,
102 so the two standards often considered to be fully equivalent.
103 This was a very important milestone in the history of the C language, but the
104 development of the language did not stop.
105 .Pp
106 The ISO C standard was later extended with an amendment as
107 ISO/IEC 9899 AM1 in 1995.
108 This contained, for example, the wide-character support in wchar.h and
109 wctype.h.
110 Two corrigenda were also published: Technical Corrigendum 1 as
111 ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR1
112 in 1996.
113 The continuous development and growth made it necessary to work out a new
114 standard, which contains the new features and fixes the known defects and
115 deficiencies of the language.
116 As a result, ISO/IEC 9899:1999 was born in 1999.
117 Similarly to the other standards, this is referred after the
118 publication year as C99.
119 The improvements include the following:
120 .Bl -bullet -offset indent
121 .It
122 Inline functions
123 .It
124 Support for variable length arrays
125 .It
126 New high-precision integer type named long long int, and other integer types
127 defined in stdint.h
128 .It
129 New boolean data type implemented in stdbool.h
130 .It
131 One line comments taken from the C++ language
132 .It
133 Some new preprocessor features
134 .It
135 New variables can be declared anywhere, not just in the beginning of the
136 program or program blocks
137 .It
138 No implicit int type
139 .El
140 .Pp
141 Since then new standards have not been published, but the C language is still
142 evolving.
143 New and useful features have been showed up in the most famous
144 C compiler: GNU C.
145 Most of the UNIX-like operating systems use GNU C as a system compiler,
146 but those addition in GNU C should not be considered as
147 standard features.
148 .Sh SEE ALSO
149 .Xr c89 1 ,
150 .Xr c99 1 ,
151 .Xr cc 1
152 .Sh STANDARDS
153 .Rs
154 .%A ANSI
155 .%T X3.159-1989
156 .Re
157 .Pp
158 .Rs
159 .%A ISO/IEC
160 .%T 9899:1990, Programming languages -- C
161 .Re
162 .Pp
163 .Rs
164 .%A ISO/IEC
165 .%T 9899 AM1
166 .Re
167 .Pp
168 .Rs
169 .%A ISO/IEC
170 .%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1
171 .Re
172 .Pp
173 .Rs
174 .%A ISO/IEC
175 .%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2
176 .Re
177 .Pp
178 .Rs
179 .%A ISO/IEC
180 .%T 9899:1999, Programming languages -- C
181 .Re
182 .Sh HISTORY
183 This manual page first appeared in
184 .Fx 9.0 .
185 .Sh AUTHORS
186 This manual page was originally written by
187 .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .