You are on page 1of 4

Reema Thareja Computer Fundamentals and Programming in C, 2e

A P P E N D I X Versions of C

D.1 K&R C In K&R C, function declarations did not include


any information about function arguments. Therefore,
In 1978, Brian Kernighan and Dennis Ritchie published function parameter type checks were not performed.
the first edition of The C Programming Language. Their However, some compilers would issue a warning message
book, known as K&R served for many years as an if a local function was called with the wrong number of
informal specification of the language. The version of arguments or if multiple calls to an external function used
C that it describes is commonly referred to as K&R C. different numbers or types of arguments. This led to the
However, the second edition of the book covers the later development of separate tools such as Unixs lint utility
ANSI C standard. K&R introduced several language that (among other things) could check for consistency of
features such as: functions used across multiple source files.
standard I/O library After several years of publication of K&R C, a number
of unofficial features were added to the language that
long int data type
was supported by compilers from AT&T and some other
unsigned int data type
vendors. These included:
compound assignment operators of the form = op (such
void functions
as = ) were changed to the form op = to remove the
functions returning struct or union types (rather than
semantic ambiguity created by such constructs. For
pointers)
example, count = 1, which was incorrectly interpreted
assignment for struct data types
as count = 1.
enumerated types
Even after the publication of the 1989 C standard,
Finally the popularity of K&R C, large number of extensions,
K&R C was considered to be the essential component of
lack of agreement on a standard library, and the fact that not
C required by a C compiler. The C programmers restricted even the Unix compilers precisely implemented the K&R
themselves to use K&R C when maximum portability specification led to the standardization of the language.
was desired, since many older compilers were still in use,
and because carefully written K&R C code can be legal
D.2 ANSI C
Standard C as well.
In early versions of C, only those functions had to be ANSI C is the standard published by the American
declared which returned a non-integer value and were National Standards Institute (ANSI) for the C programm-
used before the function definition. A function that did not ing language. Software developers using C language to
have any previous declaration was assumed to return an develop their programs are encouraged to conform to
integer (if its value was used). the requirements stated in the document, as it encourages
easily portable code.

Oxford University Press 2016. All rights reserved.


Reema Thareja Computer Fundamentals and Programming in C, 2e

History of ANSI C and ISO C advances in compiler technology. The extensions in C99
The first standard for C was published by ANSI. Although are helpful to the programmers because they provide:
this document was subsequently adopted by International convenient ways of expressing particular algorithm
Organization for Standardization (ISO) and subsequent constructs
revisions published by ISO have been adopted by ANSI, better control for numerical purposes, for directing
the name ANSI C (rather than ISO C) is still more widely optimizations, etc.
used. Some software developers call it as ISO C, whereas
some tend to be neutral and use the term Standard C. History
After ANSI C was developed, the C language specification
C89 remained relatively static for some time, and C++
In 1983, the American National Standards Institute formed continued to evolve, largely during its own standardization
a committee, X3J11, to establish a standard specification of effort. Although a new standard for the C language was
the C language. This standard was completed in 1989 and developed in 1995, but it was done only to correct some
it is this version of C that is commonly known as ANSI details of the C89 standard and to add more extensive
C, or sometimes C89 (to distinguish it from C99). support for international character sets. However, the
C90 standard underwent further revision in the late 1990s that
resulted in the publication of ISO/IEC 9899:1999 in 1999.
In the year 1990, the ANSI C standard together with a few
This standard is commonly referred to as C99. It was
minor modifications was adopted by the Inter-national
adopted as an ANSI standard in May 2000.
Organization for Standardization as ISO/IEC 9899:1990.
This version came to be known as C90. Therefore, the terms Design
C89 and C90 refer to essentially the same language. C99 is mostly backward compatible with C90 but is stricter
in some ways. In particular, a declaration that does not have a
C99 type specifier is no longer assumed to be int. The C standards
In March 2000, ANSI adopted the ISO/IEC 9899:1999 committee decided that it was more important for the compiler
standard. This standard came to be popular as C99 which to diagnose inadvertent omission of the type specifier than
is the current standard for C programming language. to silently process legacy code that relied on implicit int.
Today, ANSI C is supported by almost all the widely used Practically, the compilers are likely to display a warning while
compilers. Needless to say, these days most of the C code compiling, assume int and continue translating the program.
being written is based on ANSI C. Any program written C99 also added certain new features, many of which had
only in standard C and without any hardware dependent already been implemented as extensions in several compilers:
assumptions is virtually guaranteed to compile correctly Inline functions
on any platform with a conforming C implementation. In
Intermingled declarations and code. With this,
the absence of such precautions, programs may compile
a variable declaration is no longer restricted to
only on a certain platform or with a particular compiler.
file scope or the start of a compound statement (block)
Compliance Detectability Addition of new data types, such as: long, long int,
To mitigate the differences between K&R C and the ANSI boolean, and a complex type to represent complex
C standard, the __STDC__ (standard c) macro can be numbers
used to split code into ANSI and K&R sections. Arrays of variable-length
#if __STDC__ Support for single-line comments beginning with //
// use code that can use new features
#else Addition of new library functions, such as snprintf
// use code that still uses obsolete Addition of new header files such as stdbool.h and
features inttypes.h
#endif
Addition of type-generic math functions (in tgmath.h)
Enhanced support for IEEE floating point
D.3 C99
Designated initializers
C99 is a modern version of the C programming language.
Compound literals
It extends the previous version (C89) to make better use
of available computer hardware and to utilize the latest Support for macros that have variable arity

Oxford University Press 2016. All rights reserved.


Reema Thareja Computer Fundamentals and Programming in C, 2e

Addition of restrict type qualifier that allows more Perl, PHP, JavaScript, LPC, C#, and Unixs C Shell. The
aggressive code optimization most pervasive influence has been syntactical as all of the
Addition of universal character names to enable user languages mentioned above combines the statement and
variables to contain characters other than the standard (more or less recognizably) expression syntax of C with
character set type systems, data models, and/or large-scale program
structures that differ from those of C, sometimes radically.
Future work The object-oriented languages such as C++ and
After the ratification of the 1999 C standard, the standards
Objective-C that had became popular were originally
working group has prepared technical reports specifying
implemented as source-to-source compilers, i.e. source
improved support for embedded processing, additional
code was translated into C, and then compiled with a C
character data types (Unicode support), and library
compiler.
functions with improved bounds checking. Effort is still
on to make technical reports addressing decimal Bjarne Stroustrup developed C++ to provide object-
floating point, additional mathematical special functions, oriented functionality with C-like syntax. C++ adds greater
and additional dynamic memory allocation functions. typing strength, scoping, and other tools useful in object-
Moreover, the C and C++ standards committees have been oriented programming and permits generic programming
collaborating on specifications for threaded programming. via templates. Usually considered as a superset of C,
In 2007, effort has also started in anticipation of another C++ now supports most of C programming, with a few
revision of the C standard, informally called C1X. The exceptions.
C standards committee has laid guidelines that restrict Unlike C++, which is generally backward compatible
the adoption of new features that have not been tested by with C, the D language makes a clean break with C while
existing implementations. maintaining the same general syntax. The D language
abandons several features of C which Walter Bright (the
designer of D) considered undesirable, including the
D.4 C1X
C preprocessor and trigraphs. However, some of Ds
C1X is the unofficial name given to the planned new extensions to C overlaps with those of C++.
standard for the C programming language. The new The object oriented programming language
standard will replace the existing C standard. Although, Objective-C is a strict superset of C that permits object-
the new standard is not yet finalized, the most recent oriented features using a hybrid dynamic/static typing
working draft, N1494, was published in June 2010 which paradigm. Objective-C derives its syntax from both C
includes several changes to the C99 language and library and Smalltalk. For example, the syntax that involves
specifications such as: preprocessing, expressions, function declarations, and
Specification of alignment such as _Align specifier, function calls is inherited from C, while the syntax for object-
alignof operator, aligned_alloc function oriented features was originally taken from Smalltalk.
Limbo is a computer programming language
Support for multi-threading by having _Thread_local
developed by the same team at Bell Labs that was
storage-class specifier, <threads.h> header file
responsible for C and Unix. It not only retains some of
that includes thread creation/management functions,
the syntax and the general style of C but also introduced
mutex, condition variable and thread-specific storage
garbage collection, CSP-based concurrency, and other
functionality
major innovations.
Enhanced support for Unicode by having char16_t and Python has a different sort of C heritage. Although the
char32_t types for storing UTF-16/UTF-32 encoded
syntax and semantics of Python are strikingly different
data, including the corresponding u and U string literal from C the most commonly used Python implementation,
prefixes and conversion functions in <uchar.h> CPython, is an open source C program. This enables C
Removal of the gets() programmers to extend Python with C, or embed Python
Interfaces for checking bounds into C programs. This close relationship among other
Analysability features factors has resulted in Pythons success as a general-use
dynamic language.
Perl is another popular programming language rooted in
D.5 LANGUAGES RELATED TO C C. Perls syntax closely follows the C syntax. Moreover,
The programming language C has directly or indirectly the standard Perl implementation is written in C and
influenced many other computer languages like Java, supports extensions written in C.

Oxford University Press 2016. All rights reserved.


Reema Thareja Computer Fundamentals and Programming in C, 2e

D.6 PROS AND CONS OF C LANGUAGE does not help, assist, or warn you about anything,
unless there is some syntactical error. Programming
Advantages of C Language pitfalls such as type mismatch, macro redefinition, or
C has always been one of the most important of all arrays index out of bound, etc., are not detected by the
computer programming languages that have been language.
developed so far. Programming with C language has the It supports extensive use of pointers. However, in modern
following advantages: programming languages, pointers are avoided as they
It is the most widely used language for writing system have proven to be insecure in certain domains.
software (i.e., operating systems, other programming It does not have efficient garbage collection.
languages, and compilers). It is a procedural language. This traditional approach to
It is a very popular language for writing application solve problems is more time consuming and difficult to
programs. understand.
It is a portable language and is easily available on many C compilers generally do not check variable types on
machines. Programs written in standard C can therefore, memory pointed to by pointers. So an error in pointer
run on any of them. arithmetic can result in pointing to invalid values that the
compiler cannot check. Therefore, it is the responsibility
It is a procedural language. Therefore, the programmer
of the programmer to do any such checking. This calls
can give step-by-step instructions for the CPU or other
for careful design and implementation of programs.
processors.
Many programmers find it difficult to understand
It is an efficient programming language.
the concept of pointers. Since a good program
It is a flexible language. must be readable by other people, a potential confusion
It has small memory requirements to store the program. can lead to future maintenance-induced code errors.
Programs written in C are capable of exploiting multi- C programs dealing with pointers are often prone to
user and multi-tasking features. errors.
It provides support for handling data stored in files. C language does not support inheritance. Hence, the
programmer has to write a lot of code, from scratch,
Programs written in C can be used for inter-process
which is very time consuming.
communication (for example, by using pipes).
Conclusion C is a powerful language that is widely
It has an extensive set of libraries to provide easy access used for developing system software. It is a universal
to useful functions. programming language, which considerably eases the
Disadvantages of C Language work of a professional programmer.
Besides the key advantages, C language has the following
shortcomings:
It follows the philosophyProgrammers knows what
to do. It does not support error detection, i.e., C language

Oxford University Press 2016. All rights reserved.

You might also like