Why C Rocks
Few modern programming languages can boast a greater longevity than that of C. Since its humble beginnings in 1972, it has been leveraged for countless software projects, including the Linux kernel, the GNU operating system and the FreeBSD project. C has stood the test of time due to its implementation of the fundamentals for software.
C was created in order to aid in the porting of software to different hardware architectures. It achieves this by allowing the programmer to express low-level operations at a higher level. Therefore, C can perhaps be considered a universal programming language, as a program written in C has the potential to target limitless hardware.
Another factor that reinforces the idea of C having high compatibility is the fact that most other programming languages provide a mechanism for establishing C bindings. Examples of this would be language linkage in C++, extensions in PHP, and the cgo command for Go. Even the Web can be targeted by using Emscripten to generate WebAssembly. Hence, there are not only limitless hardware targets for C programs, but also limitless software environments.
The associated overhead of running such programs is therefore mitigated, as C can be compiled directly to machine code.
The syntax of C has influenced a plethora of programming languages, including Go, Java and PHP to name just a few. It manages to achieve this whilst also having a relatively small number of features built into the language. For a rough comparison, “The C Programming Language” book contains approximately 220 pages, while “The C++ Programming Language” book contains approximately 1,280 pages. Despite the apparent lack of functionality, all conceivable computations can be expressed in C.
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupery
Although C allows for a wide range of expression, it lacks type safety. This is particularly true when attempting to program generically. Although macros can be leveraged to generate such code, they can cause additional challenges when debugging.
C has existed for a long while, and will likely continue to exist for a long while yet. This is due to its compatibility with various hardware architectures and software environments, its speed, and its expressive syntax. It achieves this whilst having a relatively small specification, which is a testament to the sentiment that less is more.