Why C?
:date: 2026-07-23 07:56
:tags:
For the last couple of months I've been deep in the software mines
laboring away at a big project that I will be revealing and writing
more about very soon. Today I wanted to get things going with a
preemptive justifcation of the primary tool I used for the project.
- C is the unambiguous
high
performance GOAT. Other languages measure their speed by how much
slower they are than C. When you write software in another language
you will always wonder how fast it could have been had you written
it in C. BTW, whenever a language is reported to outperform C in
some weird edge case and that language itself was written in C, I'm
sharing the win with team C.
- Generally better ecologically.
This interesting paper
shows that fastest execution speed does not always equal lowest
calories. But generally it does and except for some unusual cases, C
is the champion of both.
"By observing the data in Table 4, we can see that the C language is, overall,
the fastest and most energy efficient."
- Used by very serious, very well respected projects. It was also
heavily used by the people who created it. To say that the Bell Labs
people made better software than what most people use today is like
saying that the artwork commissioned by the Medici popes is better
than the typical Powerpoint presentation.
- It's quite free. GCC actually stands for the
GNU Compiler
Collection (because it supports
C++, Fortran, Go, Rust, et al) but of course it was originally the
GNU C compiler just as the original
cc command stood simply for "C
compiler". The GNU project literally invented explicit software
freedoms and GCC is its flagship software. Obviously GCC is
primarily written in C. If you like your software freedom to have a
rich robust aroma, yet be slightly less jittery, and with fruity
notes of apple, you can also use
LLVM/Clang.
- It is not (naturally) object oriented. 25 years ago I went all in
with
OOP. I
developed several of my big projects in C++ and Python. Despite
having faith in the hope and hype of OOP, over the years I have
had to honestly assess its value. I have discovered that in
retrospect it has almost never been helpful to me. It has definitely
never been more beneficial than its overhead in extra complexity,
ambiguity, and loss of control. (See my
xedNN project where I finally am able to
see how a neural network really functions because I unravel it
from obfuscated OOP.) I now suspect that OOP is like flowcharts or
UML in that
it seems like it must be a reasonable step toward progress but in
reality it is an obfuscatory muddle with mostly imagined benefits.
Note that OOP is often a win for "end user" type programmers who are
just deploying a library; I feel like OOP makes the job of library
developers much harder but can make using the library easier. If
you're writing your own software properly from scratch, the benefits
are questionable.
- Properly portable. From microcontrollers to the emulated CPUs of
long forgotten systems to the latest chips running all modern
hardware. A processor chip is still in development until it has the
support of a C compiler.
- Porting software from one language to another very often goes with C
libraries as a common format that pretty much all sensible languages
can link to.
- Low level memory and resource management. Do you like shooting
yourself in the foot more than being shot in the foot by other
people? Then you'll appreciate C memory management.
- Massive ecosystem of libraries which are often the reference
standard and highest performing implementation. For example, one is
unlikely to find a vector math library
or a regular expression library that beats
the most popular C one.
- While there are some goofy (and possibly useful) "modern" versions
of C (e.g.
C23), the
development of C is extremely stable. Even C23's new features are
pretty well aligned with not fixing something that isn't broken.
Ancient original K&R is seldom used today but it is completely
comprehensible by any C programmer and it does still compile.
Reading the original K&R C book is still probably one of the best
ways to understand the language. In contrast to C, C++ is constantly
metastasizing new and baroque features and syntax. I even created
this little meme for my C++ notes to
highlight the absurdity of it.
- It's deterministic and has low run time overhead. C has no hidden
overhead, no hidden garbage collection pauses, no virtual machine
startup time, and no runtime checks (unless explicitly enabled).
This makes it ideal for critical real time hardware control and,
really, any software if you can pull it off.
- Closest to the hardware. What's important to me is that this means
it is closest to The Truth. Sometimes the truth is not pleasant
and you may wish something else were true, but I never wish to be
deceived about The Truth.
I like interacting with hardware from a software perspective and I
have yet to see a language that comes even close to C in that respect.
It's not just that you can use C to generate good code for hardware.
It's that if you think like a computer, writing C actually makes
sense.
Are there ever any good reasons not to use C? Absolutely. And they
help illustrate when you should.
- When someone offers to pay a lot of money to use something else,
reasonable people will sometimes do that. Similarly contract
software generally has little incentive to be lightweight,
transparent, and easy to hand off to one's competitors.
- C asks you to do things yourself, to program the computer yourself.
If you are a professional computer programmer, C is perfectly
compatible with your skills. If you do not have the skills to
program in C — if you can not think like a computer — you many not
have what it takes to be a professional computer programmer.
- C is the correct choice if the goal is to create your own software.
If you are trying to use your own software to produce something
else (a geotechnical report, a gearbox design, a web site, an AI
model, etc), then it is often much easier to use tools that are
already much closer to the true goal.
- Some people love Python's semantic whitespace syntax. Such people
can struggle with C because it forces you to use syntax that is
either redundant or an abomination. What do I mean by that? Stay
tuned, for I have cured this problem!