The initial development of C occurred at AT&T Bell Labs between 1969 and 1973; according to Ritchie, the most creative period occurred in 1972. It was named "C" because many of its features were derived from an earlier language called "B." Accounts differ regarding the origins of the name "B": Ken Thompson credits it as being a stripped down version of the BCPL programming language, but he had also created a language called Bon in honor of his wife Bonnie.
There are many legends as to the origin of C and the closely related UNIX operating system, including:
The development of C was the result of programmers' desire to play Space Travel. They had been playing it on their company's mainframe, but as it was underpowered and had to support about 100 users, Thompson and Ritchie found they did not have sufficient control over the spaceship to avoid collisions with the wandering space rocks. This led to the decision to port the game to an idle PDP-7 in the office. As this machine lacked an operating system, the two set out to develop one, based on several ideas from colleagues. Eventually it was decided to port the operating system to the office's PDP-11, but faced with the daunting task of translating a large body of custom-written assembly language code, the programmers began considering using a portable, high-level language so that the OS could be ported easily from one computer to another. They looked at using B, but it lacked functionality to take advantage of some of the PDP-11's advanced features. This led to the development of an early version of the C programming language.
The justification for obtaining the original computer to be used in developing the UNIX operating system was to create a system to automate the filing of patents. The original version of the UNIX system was developed in assembly language. Later, the entire operating system was rewritten in C, an unprecedented move at a time when nearly all operating systems were written in assembly.
By 1973, the C language had become powerful enough that most of the UNIX kernel, originally written in PDP-11/20 assembly language, was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly. (Earlier instances include the Multics system (written in PL/I), and MCP (Master Control Program) for Burroughs B5000 written in ALGOL in 1961.)
[edit]
K&R C
In 1978, Dennis Ritchie and Brian Kernighan 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 the following features to the language:
struct data types
long int data type
unsigned int data type
The =+ operator was changed to += to remove the semantic ambiguity created by the construct i=+10, which could be interpreted as either i =+ 10 or i = +10
K&R C is often considered the most basic part of the language that a C compiler must support. For many years, even after the introduction of ANSI C, it was considered the "lowest common denominator" to which C programmers restricted themselves when maximum portability was desired, since not all compilers were updated to fully support ANSI C, and because with care, K&R C code can be written to be legal ANSI C as well.
In these early versions of C, only functions that returned a non-integer value needed to be declared if used before the function definition. A function used without any previous declaration was assumed to return an integer.
Since the K&R prototype did not include any information about function arguments, function parameter type checks were not performed, although some compilers would issue a warning message if a function was called with the wrong number of arguments.
In the years following the publication of K&R C, several "unofficial" features were added to the language, supported by compilers from AT&T and some other vendors. These included:
void functions and void * data type
Functions returning struct or union types (rather than pointers)
Assignment for struct data types
const qualifier to make an object read-only
A standard library incorporating most of the functionality implemented by various vendors
Enumerated types
ANSI C and ISO C
The C Programming Language, 2nd edition, is a widely used reference on ANSI C.During the late 1970s, C began to replace BASIC as the leading microcomputer programming language. During the 1980s, it was adopted for use with the IBM PC, and its popularity began to increase significantly. At the same time, Bjarne Stroustrup and others at Bell Labs began work on adding object-oriented programming language constructs to C. The language they produced, called C++, is now the most common application programming language on the Microsoft Windows operating system; C remains more popular in the UNIX world. Another language developed around that time is Objective-C which also adds object-oriented programming to C. While now not as popular as C++, it is used to develop NEXTSTEP and therefore Mac OS X's Cocoa applications.
In 1983, the American National Standards Institute (ANSI) formed a committee, X3J11, to establish a standard specification of C. After a long and arduous process, 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, or sometimes C89 (to distinguish it from C99).
In 1990, the ANSI C standard (with a few minor modifications) was adopted by the International Organization for Standardization (ISO) as ISO/IEC 9899:1990. This version is sometimes called C90. Therefore, the terms "C89" and "C90" refer to essentially the same language.
One of the aims of the ANSI C standardization process was to produce a superset of K&R C, incorporating many of the unofficial features subsequently introduced. However, the standards committee also included several new features, such as function prototypes (borrowed from C++), and a more capable preprocessor. The syntax for parameter declarations was also changed to reflect the C++ style:
ANSI C is now supported by almost all the widely used compilers. Most of the C code being written nowadays is based on ANSI C. Any program written only in standard C and without any hardware dependent assumptions is virtually guaranteed to run correctly on any platform with a conforming C implementation. Without such precautions, most programs may compile only on a certain platform or with a particular compiler, due, for example, to the use of non-standard libraries, such as GUI libraries, or to the reliance on compiler- or platform-specific attributes such as the exact size of certain data types and byte endianness.
After the ANSI standardization process, the C language specification remained relatively static for some time, whereas C++ continued to evolve. (Normative Amendment 1 created a new version of the C language in 1995, but this version is rarely acknowledged.) However, the standard underwent revision in the late 1990s, leading to the publication of ISO 9899:1999 in 1999. This standard is commonly referred to as "C99." It was adopted as an ANSI standard in March 2000.
The new features in C99 include:
Inline functions
Variables can be declared anywhere (as in C++), rather than only after another declaration or the start of a compound statement
Several new data types, including long long int (to reduce the pain of the looming 32-bit to 64-bit transition), an explicit boolean data type, fixed-width integer types, and a complex type to represent complex numbers
Variable-length arrays
Support for one-line comments beginning with //, as in BCPL or C++, already supported by many C compilers as an extension
New library functions, especially replacements for buffer overflow prone functions, such as snprintf()
New header files, such as stdint.h
Support for sparse initializers
Support for variadic macros
GCC and several other C compilers now support most of the new features of C99. However, there has been less support from vendors such as Microsoft and Borland that have been mainly focused on C++, since C++ provides similar functionality in often incompatible ways (e.g., the complex template class). Microsoft's Brandon Bray said "In general, we have seen little demand for many C99 features. Some features have more demand than others, and we will consider them in future releases provided they are compatible with C++."
Even GCC with its extensive C99 support still does not approach a completely compliant implementation; several key features are missing or don't work correctly.
2006-06-30 10:06:44
·
answer #4
·
answered by williegod 6
·
0⤊
0⤋