A Brief History of C++

Nowadays computers are able to perform many different tasks, from simple mathematical operations to sophisticated animated simulations. But the computer does not create these tasks by itself; these are performed following a series of predefined instructions called computer languages. A computer language is a set of instructions and a series of lexical conventions specifically designed to order computers what to do. In these times, computer languages have undergone dramatic evolution since the early electronic computer, Colossus, was built to breaking codes used by Germany army during World War II. Early on, programmers worked with the most primitive computer instructions, machine language. These instructions were represented by long strings of ones and zeros. Soon, assemblers were invented to map machine instructions to humanly readable and manageable mnemonics, such as ADD, JMP and MOV.

As time passes, higher-level languages developed, such as Smalltalk, BASIC, Pascal and COBOL. These enabled people to work with something approximating words and sentences, and may be more abstract, easier to use, or more portable. These instructions were translated back into machine language by interpreters and compilers. An interpreter translates a program as it reads it, turning the programmer’s program instructions, or code, directly into actions. Compilers translate the code into an intermediary form. This step is called compiling, and produces an object file. The compiler then invokes a linker, which turns the object file into an executable program. Most modern compilers and linkers are designed to work together as a team, and the transition between the two is invisible to the programmer.

Because interpreters read the code as it is written and execute the code on the spot, they are easy for the programmer to work with. Compilers introduce the extra steps of compiling and linking the code, which are inconvenient, but they produce a program that runs much faster than an interpreter executing the same program, even a ratio 1/10 is not uncommon, it is because when a program is compiled, the time-consuming task of translating the source code into machine language has already been accomplished.

Another advantage of many compiled languages is that you can distribute the executable program to people who don’t have the compiler. With an interpretive language, you must have the interpreter to run the program.

For many years, the principal goal of computer programmers was to write short pieces of code that would execute quickly. The program needed to be small because memory was expensive, and it needed to be fast because processing power was also expensive. As computers have become smaller, cheaper, and faster, and as the cost of memory has fallen, these priorities have changed. Today the cost of a programmer’s time far outweighs the cost of most of the computers in use by businesses. Well-written, easy to maintain code is at a premium. “Easy to maintain” means that as business requirements change, the program can be extended and enhanced without great expense.

In the 1972, two programmers Brian Kernighan and Dennis Ritchie, at AT&T were working to develop tools that would implement UNIX operating system on a DEC PDP-11. Hence they created a new compiled language and called it C. The name came about because C was preceded by the old programming language they were using called B, which was invented by Ken Thompson. B language was influenced by BCPL that was developed by Martin Richards.

C became popular partially because it provided low-level functionality, along with a high-level control structure. A computer language is said to be a high-level language if it hides the details of the computer architecture from the programmer, rather than dealing with registers, memory addresses and call stacks, and is referred to as a low-level language if it does not. Because C did not fit either category well, it became known as a medium-level language. C allowed the manipulation of bits, bytes and addresses the basic elements with which the computer functions. Another good point about C was its portability which made it possible to adapt software written for one type of computer to another. C was created, influenced, and field tested by working programmers. The end result was that C gave the programmer what the programmer wanted. C offered the speed of assembly language and the extensibility of FORTH, but few of the restrictions of Pascal and Modula-2.

However, C had one major problem. It was structured language and procedure oriented programs could be produced. This meant that in designing a typical C program, programmer would start by describing the data and then write procedures to manipulate that data, so tried to hide data from other procedures, but it was not guarantee.

In the early 1980s, more and more computer scientists began to change the way they approached problems, and they began to realize that the languages they were using did not fit well with their new problem-solving paradigm. In the 1979, Bjarne Stroustrup designed new language and derived it from C, Simula and Algol and named it C with Classes. In the 1983 it was renamed to C++ because ++ was increment operator which increments the value of a variable after evaluating it.

C++ adds to C the concept of class, a mechanism for providing user-defined types, also called abstract data types and inheritance and runtime type binding. Other added features are virtual functions, operator and function overloading, default arguments, templates, and exception handling. C++ as a hybrid language permits the traditional programming style, so that programmers could shift to object oriented programming if and when they feel the need to do so.