]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/man/man7/c99.7
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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, c78, c89, c90, c99
31 .Nd The C programming language
32 .Sh DESCRIPTION
33 C is a general purpose programming language, which has a strong connection
34 with the UNIX operating system and its derivatives, since the vast
35 majority of those systems were written in the C language.
36 The C language contains some basic ideas from the BCPL language through
37 the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
38 The development of the UNIX operating system was started on a PDP-7
39 machine in assembly language, but it made very difficult to port the existing
40 code to other systems.
41 .Pp
42 In 1972 Dennis M. Ritchie worked out the C programming language for
43 further development of the UNIX operating system.
44 The idea was to implement only the C compiler for different
45 platforms, and implement most part of the operating system
46 in the new programming language to simplify the portability between
47 different architectures.
48 It follows that C is very eligible for (but not limited to) writing
49 operating systems and low-level applications.
50 .Pp
51 The C language did not have a specification or standardized version for
52 a long time.
53 It went through a lot of changes and improvements for ages.
54 In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
55 first book about C under the title "The C Programming Language".
56 We can think of this book as the first specification of the language.
57 This version is often referred as K&R C after the names of the authors.
58 Sometimes it is referred as C78, as well, after the publishing year of
59 the first edition of the book.
60 .Pp
61 It is important to notice, that the instruction set of the language is
62 limited to the most fundamental elements for simplicity.
63 Handling of the standard I/O and such common functions are implemented in
64 the libraries shipped with the compiler.
65 As these functions are also widely used, it was demanded to include into
66 the description what requisites the library should conform to, not just
67 strictly the language itself.
68 Accordingly, the aforementioned standards cover the library elements, as well.
69 The elements of this standard library is still not enough for more
70 complicated tasks.
71 In this case the provided system calls of the given operating system can be
72 used.
73 To not loose the portability by using these system calls, the POSIX
74 (Portable Operating System Interface) standard evolved.
75 It describes what functions should be available to keep portability.
76 Note, that POSIX is not a C standard, but an operating system standard
77 and thus is beyond the scope of this manual.
78 The standards discussed below are all C standards and only cover
79 the C programming language and the accompanying library.
80 .Pp
81 After the publication of the book mentioned before,
82 the American National Standards Institute (ANSI) started to work on
83 standardizing the language, and they announced ANSI X3.159-1989
84 in 1989.
85 It is usually referred as ANSI C or C89.
86 The main difference in this standard were the function prototypes,
87 which is a new way of declaring functions.
88 With the old-style function declarations, the compiler was unable to
89 check the sanity of the actual parameters at a function call.
90 The old syntax was highly error-prone because incompatible parameters
91 were hard to detect in the program code and the problem only showed up
92 at run-time.
93 .Pp
94 In 1990, the International Organization for Standardization (ISO) adopted
95 the ANSI standard as ISO/IEC 9899:1990 in 1990.
96 This is also referred as ISO C or C90.
97 It only contains negligible minor modifications against ANSI C,
98 so the two standards often considered to be fully equivalent.
99 This was a very important milestone in the history of the C language, but the
100 development of the language did not stop.
101 .Pp
102 The ISO C standard was later extended with an amendment as
103 ISO/IEC 9899 AM1 in 1995.
104 This contained, for example, the wide-character support in wchar.h and
105 wctype.h.
106 Two corrigenda were also published: Technical Corrigendum 1 as
107 ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR1
108 in 1996.
109 The continuous development and growth made it necessary to work out a new
110 standard, which contains the new features and fixes the known defects and
111 deficiencies of the language.
112 As a result, ISO/IEC 9899:1999 was born in 1999.
113 Similarly to the other standards, this is referred after the
114 publication year as C99.
115 The improvements include the following:
116 .Bl -bullet -offset indent
117 .It
118 Inline functions
119 .It
120 Support for variable length arrays
121 .It
122 New high-precision integer type named long long int, and other integer types
123 defined in stdint.h
124 .It
125 New boolean data type implemented in stdbool.h
126 .It
127 One line comments taken from the C++ language
128 .It
129 Some new preprocessor features
130 .It
131 New variables can be declared anywhere, not just in the beginning of the
132 program or program blocks
133 .It
134 No implicit int type
135 .El
136 .Pp
137 Since then new standards have not been published, but the C language is still
138 evolving.
139 New and useful features have been showed up in the most famous
140 C compiler: GNU C.
141 Most of the UNIX-like operating systems use GNU C as a system compiler,
142 but those addition in GNU C should not be considered as
143 standard features.
144 .Sh SEE ALSO
145 .Xr cc 1 ,
146 .Xr c89 1 ,
147 .Xr c99 1
148 .Sh STANDARDS
149 .Rs
150 .%A ANSI
151 .%T X3.159-1989
152 .Re
153 .Pp
154 .Rs
155 .%A ISO/IEC
156 .%T 9899:1990, Programming languages -- C
157 .Re
158 .Pp
159 .Rs
160 .%A ISO/IEC
161 .%T 9899 AM1
162 .Re
163 .Pp
164 .Rs
165 .%A ISO/IEC
166 .%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1
167 .Re
168 .Pp
169 .Rs
170 .%A ISO/IEC
171 .%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2
172 .Re
173 .Pp
174 .Rs
175 .%A ISO/IEC
176 .%T 9899:1999, Programming languages -- C
177 .Re
178 .Sh HISTORY
179 This manual page first appeared in
180 .Fx 9.0 .
181 .Sh AUTHORS
182 This manual page was originally written by
183 .An Gabor Kovesdan Aq gabor@FreeBSD.org .