Monday, March 4, 2013

Origination of C-Programming Language





Origination of C-Programming Language and getting its Name

To understand programming language you must be familiar with two words programming and language. Language is the collection of symbols, marks, sounds, gestures, icons and pictures that have special meaning and are used by people(may even be any creature) for sharing emotions or information among them. Programming is the process of listing the jobs in a sequence that something/somebody should have to be performed. So, programming language is the collection of notations for describing computation to people and to the machines.

C
 is a general-purpose programming language initially developed by Dennis Ritchie between 1969-1972; many of its principles and ideas were taken from earlier language B and B’s earlier ancestors CPL (Combined Programming Language) and BCPL(Basic Combined Programming Language); which are developed by Martin Richards. CPL was developed with the purpose of creating languages that were capable of both high level, machine independent programming and would still allow the programmer to control the behavior of individual bits of information. One major drawback of CPL was that it was too large for use in many applications. In 1967, BCPL was created as scaled down version of CPL while still retaining its basic features. In 1970 Ken Thomson, while working at Bell Labs, took this process further by developing the B language. B was the scaled down version of BCPL written specially for use in system programming.  Finally in 1972, a coworker of Ken Thomson, Dennis Ritchie, returned some of the generality found in BCPL to the B language in the process of developing the language we now know as C. The logic behind the name of B-programming was that it was first scaled down version of BCPL so B was used to represent the first scaled down version and was the first character of BCPL; and C-programming is the second scaled down version of BCPL and it uses the second character of the BCPL to represent the whole programming language .

C’s power and flexibility soon became apparent.  Because of this, the UNIX operating system which was originally written in assembly language, was almost immediately re-written in C. During the rest of 1970’s, C spread throughout many colleges and universities because of it’s close ties to UNIX and availability of C compiler.

The origin of C is closely tied to the development of the UNIX operating system, originally implemented in assembly language in PDP-7 by Ritchie and Thomson, incorporating several ideas from colleagues. Eventually they decided to port the operating system to PDP-11. B’s inability to take advantages of some of the PDP-11’s features, notably byte addressability, led to the development of an early version of C.

The original PDP-11 version of the UNIX was developed in assembly language. By 1973, with the addition of struct types, the C language had become powerful enough that most operating system kernel implemented in language other than assembly.

K&R C
In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The Programming Language. This book was known to C programmers as “K&R” and served as an informal specification of the language. The version of C that describes is commonly referred as K&R C. The second edition of the book covers the ANSI C standard.

K&R introduced several features and are listed below-
a)     Standard I/O library,
b)     long int data type,
c)     unsigned int data type
d)     compound assignment operators of the form =op(such as =-) were changed to the form op= to remove the semantic ambiguity created by such construct  as i=-10, which had been interpreted as i=   -10.
Even after the publication of the 1989, C standard, for many years K&R C was still considered the “lowest common denominator” to which C programmers restricted themselves when maximum portability was desired; since many older compilers were still in use, and because carefully written k&R C can be legal standard C as well.

In early versions of C, only functions that returned a non-int value needed to be declared if used before the function definition; a function used without any previous declaration was assumed to return type int.

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:
a)     void functions(i.e. function with no return value).
b)     Functions returning struct or union types (rather than pointer).
c)     Assignment for struct data type.
d)     Enumerated type.
The large number of extensions and lack of agreement on a standard library, together with the language popularity implemented the K&R specification, led to the necessity of standardization.

ANSI C and ISO C
During late 1970s and 1980s version of C were implemented for wide variety of mainframe computers, minicomputers and microcomputers, including the IBM PC, as its popularity began increase significantly.

In 1983, the American National Standards Institute(ANSI) formed a committee, X3J11, to establish a standard specification of C. X3J11 based the C standard in the UNIX implementation; however, the non-portable portion of the UNIX C library was handed off to the IEEE working group 1003 to become the basis for the 1988 POSIX standard. In 1989, the C standard was ratified as ANSI X3 159-1989 “Programming Language C”. This version of language is often referred to as ANSI C, or C89.

In 1990, the ANSI C standard(with formatting changes) was adopted by International Organization for Standardization(ISO) as ISO/ICE 9899:1990, which is sometime called C90. Therefore, the term C89 and C90 refer to same programming language.

ANSI like other national standards bodies, no longer develops the C standard independently, but defers to the international C standard maintained by the working group ISO/ICE JTC1/SC22/WJ14. National adaptation of an update to international standard typically occurs within a year of ISO publication.

One of the C standardization process was to produce the superset of K&R C, incorporating many of the unofficial features subsequently introduced. The standard committee also included several additional features such as function prototype(borrowed from C++), void pointers, supports for international character sets and locales, and processor enhancements. Although the syntax for parameter declaration was argumented to include the style used in C++, the K&R interface continued to be permitted, for compatibility with existing source code.

C89 is supported by current C compilers, and most C code being written today is based on it. Any program written only in standard C and without any hardware dependent assumption will run correctly on any platform with a confirming C implementation, with in its resource limits without such precautions, programs may compile only on certain platform or with a particular compiler.

C99
After the ANSI/ISO standardization process, the C Language specification remained relatively static for several years. In 1995 Normative Amendment 1 to the 1990 C standard was published, to correct some details and to add more extensive support for international character sets. The C standard was further revised in the late 1990’s, leading to the publication of ISO 9899:1999 in 1999, which is commonly referred to as “C99”.  It has since been amended three times by Technical Corrigenda.

C99 introduced several new features, including inline functions, several new data types (including long long int and a complex type to represent complex number), variable-length arrays, improved support for IEEE 754 floating point, support for varadic macros, and support for on-line comments beginning with //, as in BCPL or C++. Many of these had already been implemented as extensions in several C compilers.

C99 is for the most part backward compatible with C90, but stricter in some ways; in particular, a declaration that lacks a type specifier no longer has int implicitly assumed. A standard macro –STDC-VERSION- is defined with values 1999011 to indicate that C99 support is available GCC, Solaris Studio, and other C compilers now support many or all of the new features of C99.

C11
In 2007, work began on another revision of the C standard informally called “C1X” until its official publication on 2011-12-08. The C standards committee adopted guidelines to limit the adaption of new features that had not been tested existing implementations.

The C11 standard adds numerous new features of C and the library, including type generic macro, anonymous structures, improved Unicode support, atomic operations, multi-threading, and bounds-checked functions. It also makes some portions of the existing C99 library optional and compatibility with C++.



Embedded C
Historically, embedded C programming requires nonstandard extensions to the C language in order to support exotic features such as fixed-point arithmetic, multiple distinct memory banks, and basic I/O operations.
In 2008, the C standards committee published a technical report extending the C language to address these issues by providing a common standard for all implementations to adhere to. It includes a number of features not available in normal C, such as fixed-point arithmetic, named address spaces, and basic I/O hardware addressing.

C is not a very low level language, nor a big one, and is not specialized to any particular area of application. But its absence of restriction and its generality make it more convenient and effective for many tasks than supposedly more powerful languages. C is middle level language; this doesnot mean that C is less powerful, harder to use, or less of less developed. Instead C combines the advantages of a high-level language with the functionalism of assembly language. Like the higher-level language, C provides block structures, standalone functions, and some small amount of data typing. It allows the manipulation of bits, bytes, words, and pointers, like assembly but it abstracts the hardware away from the code so that something written in C is very portable, meaning that a program can be easily adapted to run on several different computers. This is the great thing for system programmers; they can get the efficiency of assembly language programming without all the fuss and then they have a highly portable program; it allows programmers to do many things that probably would be caught as errors in high-level language. This is both an advantage and disadvantage. For the inexperienced programmer, it may be confusing when the behavior of a program is not correct. A high-level language catches many more possible errors at compile time, C lacks the highly typed environment that characterizes high-level languages.

According to Brian Kernighan co-author with Dennis Ritchie of “The C Programming Language”.; “Although the absence of some of features may seems like a grave of deficiency … keeping the language down to modest size has real benefits.” Since, C is relatively small; it can be described in small space and learned quickly. It has only 32 keywords to learn and support all type of conversion (QBASIC has 159 keywords).

Uses of C
C was initially used for system development work. But why use C…???? mainly because it produces code that run nearly as fast as written in assembly language. C is mostly used for writing the following types of programming:
            -Operating System                           -Text Editors
            -Language Compilers                      -Printer Spoolers
            -Assembly                                         -Network Drivers
            -Databases                                         -Utilities
Importance/Advantages of programming in C
1)     Easy to understand
2)     Freedom of using different type of data.
3)     Short listed words could be use.
4)     Efficient and fast programming.
5)     It can be used as mid-level language.
6)     Any type of software and operating system be developed with the help of C language.
All fields have technical words. These words are useful when you communicate with people in your field. But they do not communicate with outsiders. C also has its own technical words and reserved for self maintenance with special meaning and referred as keywords or reserved words. All of keywords are listed below with corresponding version’s amendment.

Below this can be ignored

C89 has 32 keyboards
auto                                                    extern                                     sizeof
break                                                  float                                        static
case                                                    for                                           struct
char                                                    goto                                        switch
const                                                   if                                             typedef
continue                                             int                                           union
default                                                long                                        unsigned
do                                                        register                                   void
double                                                            return                                     volatile
else                                                     short                                       while
enum                                                  signed

C99 adds five more keyboards
            _bool                                                  inline
            _complex                                           restrict
            _imaginary

C11 add seven more keywords
            _Alignas                                            _Noreturn
            _alignof                                             _Static_Assert
            _Atomic                                             _thread_local
            _generic

No comments:

Post a Comment