- Learn C The Hard Way
- Preface
- Introduction: The Cartesian Dream Of C
- Exercise 0: The Setup
- Exercise 1: Dust Off That Compiler
- Exercise 2: Make Is Your Python Now
- Exercise 3: Formatted Printing
- Exercise 4: Introducing Valgrind
- Exercise 5: The Structure Of A C Program
- Exercise 6: Types Of Variables
- Exercise 7: More Variables, Some Math
- Exercise 8: Sizes And Arrays
- Exercise 9: Arrays And Strings
- Exercise 10: Arrays Of Strings, Looping
- Exercise 11: While-Loop And Boolean Expressions
- Exercise 12: If, Else-If, Else
- Exercise 13: Switch Statement
- Exercise 14: Writing And Using Functions
- Exercise 15: Pointers Dreaded Pointers
- Exercise 16: Structs And Pointers To Them
- Exercise 17: Heap And Stack Memory Allocation
- Exercise 18: Pointers To Functions
- Exercise 19: A Simple Object System
- Exercise 20: Zed's Awesome Debug Macros
- Exercise 21: Advanced Data Types And Flow Control
- Exercise 22: The Stack, Scope, And Globals
- Exercise 23: Meet Duff's Device
- Exercise 24: Input, Output, Files
- Exercise 25: Variable Argument Functions
- Exercise 26: Write A First Real Program
- Exercise 27: Creative And Defensive Programming
- Exercise 28: Intermediate Makefiles
- Exercise 29: Libraries And Linking
- Exercise 30: Automated Testing
- Exercise 31: Debugging Code
- Exercise 32: Double Linked Lists
- Exercise 33: Linked List Algorithms
- Exercise 34: Dynamic Array
- Exercise 35: Sorting And Searching
- Exercise 36: Safer Strings
- Exercise 37: Hashmaps
- Exercise 38: Hashmap Algorithms
- Exercise 39: String Algorithms
- Exercise 40: Binary Search Trees
- Exercise 41: Using Cachegrind And Callgrind For Performance Tuning
- Exercise 42: Stacks and Queues
- Exercise 43: A Simple Statistics Engine
- Exercise 44: Ring Buffer
- Exercise 45: A Simple TCP/IP Client
- Exercise 46: Ternary Search Tree
- Exercise 47: A Fast URL Router
- Exercise 48: A Tiny Virtual Machine Part 1
- Exercise 48: A Tiny Virtual Machine Part 2
- Exercise 50: A Tiny Virtual Machine Part 3
- Exercise 51: A Tiny Virtual Machine Part 4
- Exercise 52: A Tiny Virtual Machine Part 5
- Next Steps
- Deconstructing K & RC Is Dead
Deconstructing K & RC Is Dead
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 (or Rust, or Swift, or anything else).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论