Admitting Defeat On K&R in LCTHW

Use Rust or Go anyway.

By Zed A. Shaw

Admitting Defeat On K&R in LCTHW

I have lost. I am giving up after years of trying to figure out how I can get the message out that the way C has been written since its invention is flawed. Originally I had a section of my book called Deconstructing K&R C. The purpose of the section is to teach people to never assume that their code is correct, or that the code of anyone, no matter how famous, is free of defects. This doesn't seem to be a revolutionary idea, and to me is just part of how you analyze code for defects and get better at making your own work solid.

Over the years, this one piece of writing has tanked the book and received more criticism and more insults than any other thing I've written. Not only that, but the criticisms of this part of the book end up being along the lines of, "You're right, but you're wrong that their code is bad." I cannot fathom how a group of people who are supposedly so intelligent and geared toward rational thought can hold in their head the idea that I can be wrong, and also right at the same time. I've had to battle pedants on ##c IRC channels, email chains, comments, and in every case they come up with minor tiny weird little pedantic jabs that require ever more logical modifications to my prose to convince them.

The interesting data point is that before I wrote that part of the book I received positive comments about the book. It was a work in progress so I felt it'd need to be improved for sure. I even setup a bounty at one point to get people to help with that. Sadly, once they were blinded by their own hero worship the tone changed dramatically. I became actually hated. For doing nothing more than trying to teach people how to use an error prone shitty language like C safely. Something I'm pretty good at.

It didn't matter that most of these detractors admitted to me that they don't code C anymore, that they don't teach it, and that they just memorized the standard so they could "help" people. It didn't matter that I was entirely open to trying to fix things and even offered to pay people bounties to help fix it. It didn't matter that this could get more people to love C and help others get into programming. All that mattered was I "insulted" their heroes and that means everything I said is permanently broken, never to be deemed worthy ever again.

Frankly, this is the deep dark ugly evil side of programming culture. They talk all day long of how, "We're all in this together" but if you don't bow to the great altar of their vast knowledge and beg them for permission to question what they believe you are suddenly the enemy. Programmers consistently go out of their way to set themselves up in positions of power that require others to pay homage to their brilliant ability to memorize standards or know obscure trivia, and will do their very best to destroy anyone who dares question that.

It's disgusting, and there's nothing I can do about it. I cannot help old programmers. They are all doomed. Destined to have all the knowledge they accumulated through standards memorization evaporate at the next turn of the worm. They have no interest in questioning the way things are and potentially improving things, or helping teach their craft to others unless that education involves a metric ton of ass kissing to make them feel good. Old programmers are just screwed.

I can't do anything about their current power over younger new programmers. I can't prevent the slander by incompetent people who haven't worked as professional C coders…ever. And I'd rather make the book useful for people who can learn C and how to make it solid than fight a bunch of closed minded conservatives who's only joy in life is feeling like they know more about a pedantic pathetically small topic like C undefined behavior.

With that in mind, I'm removing the K&R C part of the book and I finally have my new theme. I've wanted to rewrite the book but couldn't figure out how to do it. I was held in limbo because I was personally too attached to something I felt was important, but that I couldn't advance forward. I now realize this was wrong because it prevented me from teaching many new programmers important skills unrelated to C. Skills in rigor, code analysis, defects, security flaws, and how to learn any programming language.

Now I know that I will make the book a course in writing the best secure C code possible and breaking C code as a way to learn both C and also rigorous programming. I will fill it with pandering to the pedants saying that my humble book is merely a gateway to C and that all should go read K&R C and worship at the feet of the great golden codes held within. I will make it clear that my version of C is limited and odd on purpose because it makes my code safe. I will be sure to mention all of the pedantic things that every pedant demands about NULL pointers on a PDP-11 computer from the 1960s.

And then I will also tell people to never write another C program again. It won't be obvious. It won't be outright, but my goal will be to move people right off C onto other languages that are doing it better. Go, Rust, and Swift, come to mind as recent entrants that can handle the majority of tasks that C does now, so I will push people there. I will tell them that their skills at finding defects, and rigorous analysis of C code will pay massive dividends in every language and make learning any other language possible.

But C? C's dead. It's the language for old programmers who want to debate section A.6.2 paragraph 4 of the undefined behavior of pointers. Good riddance. I'm going to go learn Go.

UPDATE: I'm going to learn Go, Rust, and Swift. Holy crap. Stop being so religious about who learns what. I learn languages now to teach them to people, not because I plan on using them for anything. Don't listen to me as a barometer of what's cool now. Peace.


More from Zed A. Shaw

The Beggar Barons

The rise of the trillionaire beggars.

OpinionPublished 2022-02-05

Sometimes, It's Fun to Die

The survival crafting video game is my pandemic theme song.

OpinionPublished 2021-04-08

The Most Zed Story About a Knife

A microcosm story that more completely explains who I am than anything else you'll read.

OpinionPublished 2020-10-08

Authoritarianism of Code

An essay on the pervasive internalized authoritarianism found in the programming profession.

OpinionPublished 2020-10-07