C is one of the most popular language around all the world, it was initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs. Many thousands of projects was developed using C since then. It’s used for all kinds of needs, we can enumerate OS, embedded applications, gaming development, image processing, word processing and database engines.
It’s interesting to discover the evolution of a language, and how it evolved over years of feedbacks from developers and end users. We will go back 25 years ago to discover how some C projects were implemented.
Back to 1990 the begining of Microsoft Word
The developers of these days remember this was a time when a typical personal computer might have an 8 Mhz processor, 1 megabyte of memory, a 20 megabyte hard disk, and a floppy disk drive. It was a big challenge to develop a word processing application.
Microsoft released the “Microsoft Word 1.1″ source code in the Copmuter History Museum. It is worth to take a look to its source code, even if it was implemented 25 years ago, we can learn very interesting techniques from it.
Here’s a code snippet from its source code:
As we can observe the function was declared in K&R style. All the functions use the same style.
When exploring many “Microsoft Word 1.1″ source files and comparing them to recently created C projects, we can be surprised that the techniques used in these projects not differ a lot from the “Microsoft Word 1.1″ implementation ones.
Let’s take as example the following source code:
It seems that this code is from a C project created recently in GitHub. No sign that’s a code from 25 years ago.
1994 was the year of the first release version of Linux
On 14 March 1994, Linux 1.0.0 was released, but the development was started in 1991, thanks to Linus Trovalds and all the other contributors. The source code of this first version is available here.
Here’s a snippet code from the sched.c source file:
When exploring the source files of Linux kernel version 1 and all the newest ones, the very surprising remark is the fact they are very similar, no big changes in the style or the techniques used. From the beginning the code was simple, clean and basic.
After a brief trip in the past of some C source code projects, they are very few implementation techniques changes between them and the new C projects ones.
The power of C is its stability over years, it remains basic, no advanced mechanism was introduced to the language, the code still simple to understand and maintain.