|File: [cvs.NetBSD.org] / src / share / man / man7 / c.7 (download)
Revision 1.12, Wed Mar 30 15:37:15 2011 UTC (10 years, 6 months ago) by jruoho
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, riastradh-drm2-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, cherry-xenmp-base, cherry-xenmp, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys, riastradh-drm2
Changes since 1.11: +4 -3
.\" $NetBSD: c.7,v 1.12 2011/03/30 15:37:15 jruoho Exp $
.\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" $FreeBSD: src/share/man/man7/c99.7,v 1.1 2010/06/17 12:05:47 gabor Exp $
.Dd March 30, 2011
.Dt C 7
.Nm c, c78, c89, c90, c99
.Nd The C programming language
C is a general purpose programming language, which has a strong connection
with the UNIX operating system and its derivatives, since the vast
majority of those systems were written in the C language.
The C language contains some basic ideas from the BCPL language through
the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
The development of the UNIX operating system was started on a PDP-7
machine in assembly language, but this choice made it very difficult
to port the existing code to other systems.
In 1972 Dennis M. Ritchie worked out the C programming language for
further development of the UNIX operating system.
The idea was to implement only the C compiler for different
platforms, and implement most parts of the operating system
in the new programming language to simplify the portability between
It follows that C is very well adapted for (but not limited to) writing
operating systems and low-level applications.
The C language did not have a specification or standardized version for
a long time.
It went through a lot of changes and improvements for ages.
In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
first book about C under the title
.Dq The C Programming Language .
We can think of this book as the first specification of the language.
This version is often referred to as
.Dq K&R C
after the names of the authors.
Sometimes it is referred to as C78, as well, after the publishing year of
the first edition of the book.
It is important to notice that the instruction set of the language is
limited to the most fundamental elements for simplicity.
Handling of the standard I/O and similar common functions are implemented in
the libraries shipped with the compiler.
As these functions are also widely used, it was demanded to include into
the description what requisites the library should conform to, not just
strictly the language itself.
Accordingly, the aforementioned standards cover the library elements, as well.
The elements of this standard library are still not enough for more
In this case the provided system calls of the given operating system can be
To not lose the portability by using these system calls, the POSIX
(Portable Operating System Interface (for Unix)) standard evolved.
It describes what functions should be available to keep portability.
Note, that POSIX is not a C standard, but an operating system standard
and thus is beyond the scope of this manual.
The standards discussed below are all C standards and only cover
the C programming language and the accompanying library.
After the publication of the book mentioned before,
the American National Standards Institute (ANSI) started to work on
standardizing the language, and in 1989 they announced ANSI X3.159-1989.
It is usually referred to as ANSI C or C89.
The main difference in this standard were the function prototypes,
which was a new way of declaring functions.
With the old-style function declarations, the compiler was unable to
check the sanity of the actual parameters of a function call.
The old syntax was highly error-prone because incompatible parameters
were hard to detect in the program code and the problem only showed up
In 1990, the International Organization for Standardization (ISO) adopted
the ANSI standard as ISO/IEC 9899:1990.
This is also referred to as ISO C or C90.
It only contains negligible minor modifications against ANSI C,
so the two standards are often considered to be fully equivalent.
This was a very important milestone in the history of the C language, but the
development of the language did not stop.
The ISO C standard was later extended with an amendment as
ISO/IEC 9899 AM1 in 1995.
This contained, for example, the wide-character support in wchar.h and
Two corrigenda were also published: Technical Corrigendum 1 as
ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR2
The continuous development and growth made it necessary to work out a new
standard, which contains the new features and fixes the known defects and
deficiencies of the language.
As a result, ISO/IEC 9899:1999 was born in 1999.
Similarly to the other standards, this is referred to after the
publication year as C99.
The improvements include the following:
.Bl -bullet -offset indent
Support for variable length arrays.
New high-precision integer type named
.Vt long long int ,
and other integer types described in
.Xr stdint 3
.Xr inttypes 3 .
New boolean data type; see
.Xr stdbool 3 .
One line comments taken from the C++ language.
Some new preprocessor features.
A predefined identifier
New variables can be declared anywhere, not just in the beginning of the
program or program blocks.
Since then no new standards have been published, but the C language is still
New and useful features have been showing up in the most famous
C compiler: GNU C
.Pq Xr gcc 1 .
Most of the UNIX-like operating systems use GNU C as a system compiler,
but the various extensions of GNU C, such as
.Xr attribute 3
.Xr typeof 3 ,
should not be considered standard features.
.Sh SEE ALSO
.Xr c89 1 ,
.Xr c99 1 ,
.Xr cc 1 ,
.Xr cdefs 3
.%A Brian W. Kernighan
.%A Dennis M. Ritchie
.%B The C Programming Language
.%N Second Edition, 40th printing
.%I Prentice Hall
.%T 9899:1990, Programming languages -- C
.%T 9899 AM1
.%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1
.%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2
.%T 9899:1999, Programming languages -- C
.%T 9899:1999 TCOR1, Programming languages -- C, Technical Corrigendum 1
.%T 9899:1999 TCOR2, Programming languages -- C, Technical Corrigendum 2
.%T 9899:1999 TCOR3, Programming languages -- C, Technical Corrigendum 3
This manual page first appeared in
.Nx 6.0 .
This manual page was written by
.An Gabor Kovesdan Aq gabor@FreeBSD.org .