October 05, 2022

The remarkable success of the C programming language

 

With the advent of the C++ language and more recently the advent of Java, Python and other modern language, the good old ansic language has felt out of fashion. At least this is the public perception if the amount of github repositories and the amount of stackoverflow questions are counted. Newly created projects and newly asked questions are mostly about every language except Ansi C.
This situation stands in contrast to the importance of the ansi c language in the past. So there is a need to explain what the status of Ansi c was in the late 1980s. According to some older books from this time, the C language was some sort of standard language used for professional software development. It has emerged in the context of UNIX and then it was adapted on 16bit home computers like Amiga 500 and on MS-DOS PCs as well. 10 out of 10 randomly selected games and application software like databases from the 1980s were written in C.
It is important to know, that the C++ language wasn't used during this time. At least for the time until 1990 the only important language was Ansi-C. Ansi-C is a modular compiled language which runs highly efficient on all sorts of computers. It is known as a difficult to learn which has to do with the header files and the pointers, but it seems, that learning the language is only a question how often it was used.
The situation with C has changed dramatically after the year 1990. At least the published information in the books are explaining to the audience that C is outdated and that the future has to do with object oriented programming under newly created GUI frameworks like Windows 3.x The open question is what is the role of the C language from 1990 to 2000? There are two possible situation available. Either the ansi c language has become obsolete and was replaced by more powerful languages like C++, or the ansi c language was used continuously and only the public description has changed.
The main difference between Ansi c and C++ is, that only C++ is objected oriented. OOP means to use classes and inheritance. Another famous OOP language from the 1990s was Borland delphi and Java. There is some sort of similarity between C and C++ and as a consequence it is often described as C/C++. But from a programming perspective there is a fundamental difference between the languages available. And this difference isn't described very well in the existing literature.
The main cause why C++ has become popular is because it allows to create larger applications and works very well with GUI frameworks. But, in theory the Ansi c language fulfills the same purposes. The modularity allows to create larger software and the language fits great to GUI applications.
To recognize the difference between C and C++ it makes sense to analyze real software projects namely Debian Hamm which was published in 1998. During that time, the C++ available was available but it was seldom used in Debian. 74% of the source code was programmed in Ansi-C while 6% were created in C++ which was mostly Qt. Getting precise numbers for the Windows XP OS which was released in 2001 is a bit harder. According to online forums the core was written in Ansi C but it remains open how many lines of code exactly.
The working hypothesis is, that there is no need to switch from Ansi-C to C++ because Ansi-C is powerful enough to write all sort of software including GUI apps. The bottleneck is not the compiler but the available tutorials to teach the subject to programmers.
To verify if the thesis is correct or wrong we have to analyze the lifetime of programming books and compilers. Are the ansi C books from late 1980s outdated today, or is the information still relevant? The assumption is, that these books are still relevant. The knowledge written in a book from 1990 can be used 1:1 to understand current software. And this implies that the Ansi C language was never replaced by C++ but all the software is written in modular C while OOP isn't used in the reality.
Such a perspective contradicts the public awareness of programming languages. On major forums like Stackoverflow many questions are asked about creating classes and inheritance. Are these posts not relevant for writing software in the real world? The assumption is, that OOP languages like Java or Python are used by amateurs similar to Turbo pascal, but production software and commercial programs are written in a modular fashion with Ansi C.
[1] Debian programming languages https://sources.debian.org/stats/