Hacker News new | ask | show | jobs
by protomyth 4091 days ago
"You should definitely have a copy of K&R on your desk."

I ask honestly, why? Other than nostalgia and as a signal to others what does it bring the modern C programmer? I have it on my shelf, but it is part of my history.

2 comments

"I ask honestly, why?"

As you say yourself, it is part of your history, you've probably forgotten which concepts that K&R taught you and the OP is trying to learn C from scratch.

The OP mentions that they are learning C to help them with their reverse engineering skills, so learning about the older ways that C was programmed is also invaluable as those insecure programming techniques are still (unfortunately) widely used today and if OP wants to exploit such bugs, then all information is useful!

You mention nostalgia, and yes that is certainly one of the reasons as in my opinion the preface, the preface to the second edition and the introduction in the K&R book are worth the cost alone.

Besides, the book is so thin and flexible and makes a perfect ultra-portable, high-definition, long-life, skills acquisition device that works well on bus journeys, flights etc. ;)

I would say owning it is better than not.

"the OP is trying to learn C from scratch"

This weighed heaviest in my mind. K&R is a poor book to learn modern C. Its like saying a person starting out with Fortran today should learn from a book written for FORTRAN 77. It might be ok later once better habits have set in, but for someone who didn't live through that era, it just seems like a waste of time and money for learning modern C.

I am still convinced its a signal to others and an aspiration for what we want out of language authors, but it just isn't up to date for the task of being the first C book someone reads.

When I read it first time, it was ok to start to write C programs. When a read it again later I understood that it was much deeper and complete than it seemed first time.

Then, every time I learned something in programming using C (studying operating systems), I read K&R again and found that the answer was there even if I didn't see it before. So it was a good way for me to "validate" that I understood something new.

Note that I never used C at a very high level, and I don't know what is modern C programming, so it may not apply.

It's still a historical relic with little to no applicability today. K&R style C is awful by comparison with modern C.

If you want to learn C history, it's invaluable. If you want to learn C, it's only the first of many books you'll have to read.