Hacker News new | ask | show | jobs
by muyuu 3411 days ago
>thinking it's the K&R of C++.

You nailed it with that analogy though.

K&R is a "first book" and important historically, but right now it's an atrocious book if you want to learn current C and this has been the case for a long, long time.

Sometimes these first books don't withstand the test of time.

4 comments

That's not entirely fair - it's not just about being first.

K&R may be archaic now, even obsolete. However, for decades it has was held up as a an example of what a good technical/language book could be. You don't have to agree with the assessment to agree with the fact - that this was touted as a very good technical book for various reasons.

There never was a "K&R" of C++. That's not unusual, many languages are in the same boat. If you want to go back to the "firsts" it would be a combination of The C++ Primer and Strousoup, putting them together gave you something that was both more and less that K&R was for C.

I first studied the K&R in the early 90s, and it was already terrible by then. Especially if you wanted to teach anything other than quirky systems programming.

From the software engineering point of view, almost every single code example is terrible. Abundant implicit casts depending on the OS, loops that leak buffered reading between iterations, etc etc.

Just no. Never, ever recommend K&R to anybody as a general programming book neither for C or in general. Only the intro descriptions of language characteristics and important functions of the standard library are any use, and then again even these are extremely obsolete now.

Sure, it was a snapshot in time. By the nineties it was already old. I'm not defending it at all as book to learn C from.

There is, however (like or not), a reason we even now say "X is the K&R of Y". As such it is a bit silly to claim that the only reason K&R succeeded as well as it did was by being early....

True, but it maintains a cult following, for lack of better wording.
> but right now it's an atrocious book if you want to learn current C and this has been the case for a long, long time.

Strongly disagree.

What's a good book for learning current C?
I can recommend "C Programming: A Modern Approach 2nd Ed."[1].

1 - http://knking.com/books/c2/index.html

Even though it was published in 2008?
Absolutely!

There's not a whole lot that's changed in C11, (C is kind of "done" at this point) and there's not been a newer book that teaches the language so well.

Ben Klemens' 21st Century C is good.