🥩 Red Meat Friday: Is C Useful For Understanding How Computers Work

This post didn’t start as a Red Meat Friday item but as I worked on it, I got so exercised I decided it really should be one. For me, the question of whether C helps with understanding how computers work always evokes the response, “Well, Duh! Of course. Why are you even asking?” Anyone who has actually programmed in C—programmed, not just written hello_world.c or other such toy programs—will have the same response.

Negative responses mostly come from users of languages like Python, Java, Ruby, or one of the many other higher level languages that abstract away all of the low level details of what’s actually going on in the hardware. These people invariably argue that, really, C isn’t a low level language either because it doesn’t address such low level details as pipelining or speculative execution. Those arguments merely prove that these people have no idea what they’re talking about. No programming language addresses those issues. C is a low-level programming language because it maps reasonably well to the assembly language of a generalized model of a machine with registers, a stack, and a flat memory model. Even X86 CPUs in real mode can be represented by that model so it’s a useful concept.

Yet the question gets asked over and over again and the comments invariably bring up the same silliness. A huge amount of useful code gets written in Python and the other higher order languages so programmers who write only in those languages are by no means a lesser breed but it’s certainly true that most of them probably have no more idea of what’s going on under the hood than the average homemaker has about the physics of cooking. Both produce useful results but it’s silly to believe that their understanding of the underlying processes is as good as that of professional chefs or C programmers.

The TL;DR is that you can be a great programmer who sticks to, say, Python and produce extraordinary useful programs but if you only know Python, you probably don’t have much idea of how computers work. If you want to find out, programming in C is a good way to do that.

This entry was posted in General, Programming and tagged , . Bookmark the permalink.