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