Ken Thompson & Dennis Ritchie

1 - About the C language

The C language is an imperative and generalist programming language. Invented in the early 1970  to rewrite UNIX, C has become one of the most used languages. Many more modern languages ​​like C ++, C #, Java and PHP have aspects of C.
The C language was invented in 1972 at Bell Laboratories. It was developed at the same time as UNIX by Dennis Ritchie and Ken Thompson. Ken Thompson had developed a predecessor of C, the B language, which is itself inspired by BCPL. Dennis Ritchie has evolved the B language into a new version that is quite different, including the types, so that it is called C1.

Although C is officially inspired by B and BCPL, there is a strong influence of PL / I (or PL360); we could say that C was at Unix and PDP-11 what PL / I was for the rewriting of Multics.

Later, Brian Kernighan helped popularize the C language. He also made some last-minute changes.

In 1978, Kernighan was the main author of the book The C Programming Language describing the language finally stabilized; Ritchie took care of appendices and examples with Unix. This book is also called "K & R", and we speak of traditional C or C K & R when referring to the language as it existed at that time.

2 - Main Features

The Clanguage is an imperative and generalist programming language. It is called a low-level language in the sense that each language instruction is designed to be compiled into a fairly predictable number of machine instructions in terms of memory occupancy and computing load. In addition, it offers a range of integer and floating types designed to directly match the types of data supported by the processor. Finally, it makes an intensive use of memory address calculations with the notion of pointer.
Aside from basic types, C supports enumerated, compound, and opaque types. On the other hand, it does not propose any operation that deals directly with higher-level objects (computer file, character string, list, hash table ...). These more advanced types must be handled by manipulating pointers and compound types. Similarly, the language does not offer as standard the management of object-oriented programming or exception management system. There are standard functions for handling I / O and strings, but unlike other languages, there is no specific operator to improve ergonomics. This makes it easy to replace standard functions with functions specifically designed for a given program.

These characteristics make it a privileged language when one tries to control the material resources used, the machine language and the binary data generated by the compilers being relatively predictable. This language is therefore extremely used in areas such as embedded microcontroller programming, intensive computations, writing operating systems and modules where the speed of processing is important. It is a good alternative to the assembly language in these areas, with the advantages of more expressive syntax and portability of source code. The C language was invented to write the UNIX operating system, and remains used for system programming. So the core of large operating systems like Windows and Linux are developed largely in C.

In return, the development of C programs, especially if they use complex data structures, is more difficult than with higher-level languages. Indeed, for the sake of performance, the C language requires the user to program certain processes (memory release, verification of the validity of indices on the tables ...) that are automatically supported in high-level languages .

Stripped of the convenience provided by its standard library, C is a simple language, and its compiler is too. This is reflected in the development time of a C compiler for a new processor architecture: Kernighan and Ritchie felt that it could be developed in two months because "it will be seen that 80% of the code of a new compilers are identical to those of other existing compilers. ".

3 - Qualities and defects


The C language is one of the most used languages ​​because:

  • It has existed for a long time, the early 1970s;
  • It is based on an open standard;
  • many computer scientists know him;
  • being of the lowest portable level possible, it allows the minimization of the necessary memory allocation and the maximization of the performance, notably by the use of pointers;
  • compilers and software libraries exist on most architectures;
  • it has influenced many newer languages ​​including C ++, Java, C # and PHP; its syntax in particular is widely used;
  • it implements a limited number of concepts, which facilitates its mastery and the writing of simple and fast compilers;
  • it does not rigidly specify the behavior of the produced executable file, which helps to take advantage of the capabilities of each computer;
  • it allows the writing of software that does not need any support at runtime (neither software library nor virtual machine), the predictable behavior in runtime as in consumption of RAM, like system kernels exploitation and embedded software.

Its main disadvantages are:

  • the few checks offered by the original compilers (K & R C), and the lack of run-time checks, so that errors that could have been automatically detected during development were only execution, so at the cost of a software crash;
  • on UNIX, the lint and cflow utilities could be used to avoid such errors;
  • checks are added over time, but they are partial;
  • his approach to modularity remained at the level of what was done in the early 1970s, and largely exceeded by other languages ​​since:
  • it does not facilitate object-oriented programming;
  • it does not allow to create namespaces;
  • very basic exception handling;
  • the very limited support of genericity, despite the introduction of generic type expressions in C11;
  • the subtleties of writing portable programs, because the exact behavior of executables depends on the target computer;
  • minimal support for memory allocation and character strings, forcing programmers to deal with tedious details and sources of bugs; in particular, there is no standard crumb tray;
  • serious bugs that can be caused by a simple lack of attention of the developer; such as buffer overflow, which constitutes a computer security flaw exploitable by malware;
  • some errors can only be detected automatically using additional and non-standard tools, such as lint and Valgrind;
  • low language productivity compared to newer languages

Younes Derfoufi CRMEF OUJDA

Leave a Reply