As you know, C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. It has since become one of the most widely used programming languages of all time, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by the American National Standards Institute (ANSI) since 1989 and subsequently by the International Organization for Standardization (ISO).
In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language. This book, known to C programmers as "K&R", served for many years as an informal specification of the language. The version of C that it describes is commonly referred to as K&R C. The second edition of the book covers the later ANSI C standard, described below.
K&R introduced several language features:
- Standard I/O library
long intdata type
unsigned intdata type
- Compound assignment operators of the form
=-) were changed to the form
-=) to remove the semantic ambiguity created by constructs such as
i=-10, which had been interpreted as
i =- 10(decrement
iby 10) instead of the possibly intended
i = -10(let
In the years following the publication of K&R C, several features were added to the language, supported by compilers from AT&T and some other vendors. These included:
voidfunctions (i.e., functions with no return value)
- functions returning
uniontypes (rather than pointers)
- assignment for
- enumerated types
In 1983, the American National Standards Institute formed a committee, X3J11, to establish a standard specification of C. The standard was completed in 1989 and ratified as ANSI X3.159-1989 "Programming Language C." This version of the language is often referred to as "ANSI C". Later on sometimes the label "C89" is used to distinguish it from C99 but using the same labelling method.
The same standard as C89 was ratified by the International Organization for Standardization as ISO/IEC 9899:1990, with only formatting changes, which is sometimes referred to as C90. Therefore, the terms "C89" and "C90" refer to essentially the same language.
In 1995, the ISO published an extension, called Amendment 1, for the ANSI-C standard. Its full name finally was ISO/IEC 9899/AMD1:1995 or nicknamed C95. Aside from error correction there were further changes to the language capabilities, such as:
- Improved multi-byte and wide character support in the standard library, introducing
<wctype.h>as well as multi-byte I/O
- Addition of
digraphsto the language
- Specification of standard macros for the alternative specification of operators, e.g.
- Specification of the standard macro
In addition to the amendment, two technical corrigenda were published by ISO for C90:
- ISO/IEC 9899 TCOR1 in 1995
- ISO/IEC 9899 TCOR2 in 1996
Preprocessor Test for C95 compatibility
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L /* C95 compatible source code. */ #elif defined(__ANSI__) /* C89 compatible source code. */ #endif
In March 2000, ANSI adopted the ISO/IEC 9899:1999 standard. This standard is commonly referred to as C99.
Some notable additions to the previous standard include:
- New built-in data types:
- Several new core language features, including static array indices, designated initializers, compound literals, variable-length arrays, flexible array members, variadic macros, and
- Several new library headers, including
- Improved compatibility with several C++ features, including
single-line comments, mixing declarations and code, universal character names in identifiers
- Removed several dangerous C89 language features such as implicit function declarations and implicit
Three technical corrigenda were published by ISO for C99:
- ISO/IEC 9899:1999/Cor.1:2001(E)
- ISO/IEC 9899:1999/Cor.2:2004(E)
- ISO/IEC 9899:1999/Cor.3:2007(E)
A standard macro
__STDC_VERSION__ is defined with value
199901L to indicate that C99 support is available.
In 2007, work began on another revision of the C standard, informally called "C1X" until its official publication on 2011-12-15. The C standards committee adopted guidelines to limit the adoption of new features that had not been tested by existing implementations.
The C11 standard adds numerous new features to C and the library
- Including type generic macros
- Anonymous structures
- Improved Unicode support
- Atomic operations
- Bounds-checked functions.
It also makes some portions of the existing C99 library optional, and improves compatibility with C++.
The standard macro
__STDC_VERSION__ is defined as
201112L to indicate that C11 support is available.