Annotation of src/share/man/man7/c.7, Revision 1.12
1.12 ! jruoho 1: .\" $NetBSD: c.7,v 1.11 2011/01/19 00:06:22 uwe Exp $
1.1 jruoho 2: .\"
3: .\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\"
14: .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17: .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24: .\" SUCH DAMAGE.
25: .\"
26: .\" $FreeBSD: src/share/man/man7/c99.7,v 1.1 2010/06/17 12:05:47 gabor Exp $
27: .\"
1.12 ! jruoho 28: .Dd March 30, 2011
1.1 jruoho 29: .Dt C 7
30: .Os
31: .Sh NAME
32: .Nm c, c78, c89, c90, c99
33: .Nd The C programming language
34: .Sh DESCRIPTION
35: C is a general purpose programming language, which has a strong connection
36: with the UNIX operating system and its derivatives, since the vast
37: majority of those systems were written in the C language.
38: The C language contains some basic ideas from the BCPL language through
39: the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
40: The development of the UNIX operating system was started on a PDP-7
1.6 wiz 41: machine in assembly language, but this choice made it very difficult
42: to port the existing code to other systems.
1.1 jruoho 43: .Pp
44: In 1972 Dennis M. Ritchie worked out the C programming language for
45: further development of the UNIX operating system.
46: The idea was to implement only the C compiler for different
1.6 wiz 47: platforms, and implement most parts of the operating system
1.1 jruoho 48: in the new programming language to simplify the portability between
49: different architectures.
1.6 wiz 50: It follows that C is very well adapted for (but not limited to) writing
1.1 jruoho 51: operating systems and low-level applications.
52: .Pp
53: The C language did not have a specification or standardized version for
54: a long time.
55: It went through a lot of changes and improvements for ages.
56: In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
1.6 wiz 57: first book about C under the title
58: .Dq The C Programming Language .
1.1 jruoho 59: We can think of this book as the first specification of the language.
1.6 wiz 60: This version is often referred to as
61: .Dq K&R C
62: after the names of the authors.
63: Sometimes it is referred to as C78, as well, after the publishing year of
1.1 jruoho 64: the first edition of the book.
65: .Pp
1.6 wiz 66: It is important to notice that the instruction set of the language is
1.1 jruoho 67: limited to the most fundamental elements for simplicity.
1.6 wiz 68: Handling of the standard I/O and similar common functions are implemented in
1.1 jruoho 69: the libraries shipped with the compiler.
70: As these functions are also widely used, it was demanded to include into
71: the description what requisites the library should conform to, not just
72: strictly the language itself.
73: Accordingly, the aforementioned standards cover the library elements, as well.
1.6 wiz 74: The elements of this standard library are still not enough for more
1.1 jruoho 75: complicated tasks.
76: In this case the provided system calls of the given operating system can be
77: used.
1.6 wiz 78: To not lose the portability by using these system calls, the POSIX
79: (Portable Operating System Interface (for Unix)) standard evolved.
1.1 jruoho 80: It describes what functions should be available to keep portability.
81: Note, that POSIX is not a C standard, but an operating system standard
82: and thus is beyond the scope of this manual.
83: The standards discussed below are all C standards and only cover
84: the C programming language and the accompanying library.
85: .Pp
86: After the publication of the book mentioned before,
87: the American National Standards Institute (ANSI) started to work on
1.6 wiz 88: standardizing the language, and in 1989 they announced ANSI X3.159-1989.
89: It is usually referred to as ANSI C or C89.
1.1 jruoho 90: The main difference in this standard were the function prototypes,
1.6 wiz 91: which was a new way of declaring functions.
1.1 jruoho 92: With the old-style function declarations, the compiler was unable to
1.6 wiz 93: check the sanity of the actual parameters of a function call.
1.1 jruoho 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
1.6 wiz 99: the ANSI standard as ISO/IEC 9899:1990.
100: This is also referred to as ISO C or C90.
1.1 jruoho 101: It only contains negligible minor modifications against ANSI C,
1.6 wiz 102: so the two standards are often considered to be fully equivalent.
1.1 jruoho 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.
1.6 wiz 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 TCOR2
1.1 jruoho 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.
1.3 dholland 117: Similarly to the other standards, this is referred to after the
1.1 jruoho 118: publication year as C99.
119: The improvements include the following:
120: .Bl -bullet -offset indent
121: .It
1.5 jruoho 122: Inline functions.
1.1 jruoho 123: .It
1.5 jruoho 124: Support for variable length arrays.
1.1 jruoho 125: .It
1.5 jruoho 126: New high-precision integer type named
127: .Vt long long int ,
128: and other integer types described in
129: .Xr stdint 3
130: and
131: .Xr inttypes 3 .
1.1 jruoho 132: .It
1.5 jruoho 133: New boolean data type; see
134: .Xr stdbool 3 .
1.1 jruoho 135: .It
1.5 jruoho 136: One line comments taken from the C++ language.
1.1 jruoho 137: .It
1.5 jruoho 138: Some new preprocessor features.
1.1 jruoho 139: .It
1.9 jruoho 140: A predefined identifier
1.11 uwe 141: .Va __func__
1.9 jruoho 142: and a
1.11 uwe 143: .Vt restrict
1.9 jruoho 144: type qualifier.
145: .It
1.1 jruoho 146: New variables can be declared anywhere, not just in the beginning of the
1.5 jruoho 147: program or program blocks.
1.1 jruoho 148: .It
1.5 jruoho 149: No implicit
150: .Vt int
151: type.
1.1 jruoho 152: .El
153: .Pp
1.6 wiz 154: Since then no new standards have been published, but the C language is still
1.1 jruoho 155: evolving.
1.6 wiz 156: New and useful features have been showing up in the most famous
157: C compiler: GNU C
158: .Pq Xr gcc 1 .
1.1 jruoho 159: Most of the UNIX-like operating systems use GNU C as a system compiler,
1.8 jruoho 160: but the various extensions of GNU C, such as
1.10 jruoho 161: .Xr attribute 3
162: or
163: .Xr typeof 3 ,
1.8 jruoho 164: should not be considered standard features.
1.1 jruoho 165: .Sh SEE ALSO
166: .Xr c89 1 ,
1.6 wiz 167: .Xr c99 1 ,
1.12 ! jruoho 168: .Xr cc 1 ,
! 169: .Xr cdefs 3
1.1 jruoho 170: .Rs
171: .%A Brian W. Kernighan
172: .%A Dennis M. Ritchie
173: .%B The C Programming Language
174: .%D 1988
175: .%N Second Edition, 40th printing
176: .%I Prentice Hall
177: .Re
178: .Sh STANDARDS
179: .Rs
180: .%A ANSI
181: .%T X3.159-1989
182: .Re
183: .Pp
184: .Rs
185: .%A ISO/IEC
186: .%T 9899:1990, Programming languages -- C
187: .Re
188: .Pp
189: .Rs
190: .%A ISO/IEC
191: .%T 9899 AM1
192: .Re
193: .Pp
194: .Rs
195: .%A ISO/IEC
196: .%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1
197: .Re
198: .Pp
199: .Rs
200: .%A ISO/IEC
201: .%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2
202: .Re
203: .Pp
204: .Rs
205: .%A ISO/IEC
206: .%T 9899:1999, Programming languages -- C
207: .Re
1.7 jruoho 208: .Pp
209: .Rs
210: .%A ISO/IEC
211: .%T 9899:1999 TCOR1, Programming languages -- C, Technical Corrigendum 1
212: .Re
213: .Pp
214: .Rs
215: .%A ISO/IEC
216: .%T 9899:1999 TCOR2, Programming languages -- C, Technical Corrigendum 2
217: .Re
218: .Pp
219: .Rs
220: .%A ISO/IEC
221: .%T 9899:1999 TCOR3, Programming languages -- C, Technical Corrigendum 3
222: .Re
1.1 jruoho 223: .Sh HISTORY
224: This manual page first appeared in
225: .Fx 9.0
226: and
227: .Nx 6.0 .
228: .Sh AUTHORS
229: This manual page was written by
230: .An Gabor Kovesdan Aq gabor@FreeBSD.org .
CVSweb <webmaster@jp.NetBSD.org>