[Home]C programming language/K and R C

HomePage | C programming language | Recent Changes | Preferences

Difference (from prior major revision) (no other diffs)

Changed: 4c4
This version is frequently regarded as an unofficial standard for the most basic features of a C compiler. Since not all of the currently-used compilers were updated to support ANSI C fully (or have certain bugs that contradict ANSI), K&R C is often seen as the lowest common denominator that should be stuck to if maximal portability is desired. Thus, for example, the bootstrap? of the the GCC compiler (xgcc) is written in K&R C, since many of the platforms that don't have an ANSI C compiler do have an older K&R one.
This version is frequently regarded as an unofficial standard for the most basic features of a C compiler. Since not all of the currently-used compilers were updated to support ANSI C fully (or have certain bugs that contradict ANSI), K&R C is often seen as the lowest common denominator that should be stuck to if maximal portability is desired. Thus, for example, the bootstrap? of the the GCC compiler (xgcc) had been written in K&R C, since many of the platforms which din't have an ANSI C compiler at the time of GCC's writing did have an older K&R one, or their existing ANSI support was incomplete. By 2001, however, this is more an historical fact rather than the current situation, since ANSI C is now supported by almost all the widely used compilers.

Changed: 6,31c6
By 2001, the above paragraph is probably a historical fact rather than the current situation. ANSI C is now supported by almost all the widely used compilers.

K&R C programs, if reasonably well written, are legal in ANSI C, and will normally have the same effect in the two dialects. This was one of aims of the ANSI C standard process, although they added more new features than is normal in programming language standardisation.

The C language evolved fairly continuously from its begining circa 1973 to the first ANSI C standard. K&R is a snapshot from this process. Features that were added between 1973 and K&R:

: struct data type

: long int data type

: unsigned int data type

: =+ (and relatives) had changed to += (and relatives)

Features added after K&R but before the begining of the ANSI C process (IE, these are NOT in K&R):
: void functions

: void * data type

: struct field names in a seperate name space for each struct type

: assignment operator works for struct data type

: the stdio library and some other standard library functions became available with most implementations (these already existed in at least one implementation at the time of K&R, but were not really standard, so not documented in the book).

In addition, several features were added in the ANSI C standardisation process itself. Most notably, function prototypes (borrowed from C++). Therefore, these were also NOT in K&R.
K&R C programs, if reasonably well written, are legal in ANSI C, and will normally have the same effect in the two dialects. This was one of aims of the ANSI C standard process, although they added more new features than is normal in programming language standardization.

Added: 32a8
See Evolution of C

K&R C stands for Kernighan and Ritchie C. Brian Kernighan and Dennis Ritchie were the authors of the White Book (The C Programming Language, popularly known as K&R) that described the programming language C. Although the language was standartized as an ANSI standard, and the book's second edition was updated to fit it, K&R C is always used to refer to the language as it is described in the first edition of the book.

This version is frequently regarded as an unofficial standard for the most basic features of a C compiler. Since not all of the currently-used compilers were updated to support ANSI C fully (or have certain bugs that contradict ANSI), K&R C is often seen as the lowest common denominator that should be stuck to if maximal portability is desired. Thus, for example, the bootstrap? of the the GCC compiler (xgcc) had been written in K&R C, since many of the platforms which din't have an ANSI C compiler at the time of GCC's writing did have an older K&R one, or their existing ANSI support was incomplete. By 2001, however, this is more an historical fact rather than the current situation, since ANSI C is now supported by almost all the widely used compilers.

K&R C programs, if reasonably well written, are legal in ANSI C, and will normally have the same effect in the two dialects. This was one of aims of the ANSI C standard process, although they added more new features than is normal in programming language standardization.

See Evolution of C


This article (or an earlier version of it) contains material from FOLDOC, used with permission.

HomePage | C programming language | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited November 10, 2001 5:47 pm by Uriyan (diff)
Search: