Live data from Hacker News

32 years on, K&R's "The C Programming Language" still stands alone

reprog.wordpress.com

61–70 of 70 posts

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#61
post #51
post #23

K&R is overrated, just like many "cult" books are. I read C: ARM by Harbison and Steele and after trying to read K&R I stopped because I wasn't getting anything new out of it. Edit: Further proof of this is the blind downvoting typical of critiques of "cult" books. K&R just happened to be there at the right time and it was the first programming book for many people. Their nostalgia makes them think that it is a very…

I'm reading it for the first time right now, and without nostalgia, at 100 pages in I'm very impressed.

Flip to the part about longjmp, and see if you still are.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#62
post #10
post #7

The thing that has always struck me about K&R is that it contains no fluff. You get so much information for each paragraph, that you often have to re-read them to get all the information contained therein. Probably the programming book I've used the most. In contrast, the C++ programming language is a mouthful, and ended up being just another pretty book on my bookshelf.

Stroustrop is, or at least in its later editions became, a pretty indespensable C++ book. Most of the topics in C++ are best addressed by it. Unfortunately, C++ is a nightmare of a language, so there are many, many topics, and you don't read it cover-to-cover any more than a cook would read New Pro Chef or McGee cover-to-cover.

I have read neither K&R nor the C++ book cover-to-cover, but the C++ book is standing practically unused on my bookshelf, while my K&R is noticeably worn.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#63

It was written in a different era where publishers weren't inflating page counts for sales.

It doesn't hurt that the total number of constructs in K&R C is really quite small. I'm not sure there are any current languages with comparably few constructs; maybe Arc. Even Scheme is bigger, at least for a recent version (say, R6RS).

True, but the revolt against R6RS has been ... fierce. None of the new steering committee members was in favor of it and we expect a move back towards the old virtues.

Still, Scheme does try to address a lot of higher level things, e.g. the full numeric tower, whereas C shines as a universal very close to the metal assembler.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#64

It was written in a different era where publishers weren't inflating page counts for sales.

It doesn't hurt that the total number of constructs in K&R C is really quite small. I'm not sure there are any current languages with comparably few constructs; maybe Arc. Even Scheme is bigger, at least for a recent version (say, R6RS).

Even with that, look at the books on C programming in stores (there still are a few). All of them are at least double the size of the K&R book.

Of all the C++ books, there was a C++ in 10 minutes from SAMS that was small, dense packed, and informative. It was really weird coming from them.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#65

How does it compare to C Programming: A Modern Approach, by K.N. King? That was great for learning C. Very readable.

Really, downmodded for politely asking an honest question? Had anyone used both? Will I get downmodded for asking another question?

Kneejerk downmodding has become somewhat epidemic recently (in the last few months?). Most of the time more thoughtful users tends to correct this problem later on, though.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#66
post #20

Earlier quoted context omitted.

The point is not that, but that as soon as you make slightly nontrivial declarations it is not readable in one pass.

If that's what you consider "slightly nontrivial", I never want to see what you would consider a difficult type declaration.

I'd volunteer some Haskell, but I am afraid that while complex, it doesn't have enough line noise in the type declarations.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#67
post #52

Earlier quoted context omitted.

C's syntax is much more terse than Pascal's; whether that makes it better or worse is open to discussion. begin...end or {...} ? I would argue that Pascal's syntax is easier to learn, but that C's is easier to use once learned. And since I spend more time using languages than learning them, the latter is more important to me.

In the 80's we used to say: "You can't compare Pascal to C. It's like comparing a bicycle with training wheels to a ten-speed racing cycle."

> to a ten-speed racing cycle.

Lacking brakes.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#68
post #65

Earlier quoted context omitted.

Really, downmodded for politely asking an honest question? Had anyone used both? Will I get downmodded for asking another question?

Kneejerk downmodding has become somewhat epidemic recently (in the last few months?). Most of the time more thoughtful users tends to correct this problem later on, though.

It probably helps that downvoting is only possible for newer posts (at least from my perspective), while upvoting is always possible.

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#69
post #9

There is, essentially, nothing to be known about C beyond what is in this book. If you can read those 272 pages, and understand them all, then you are well on the way to being a C wizard. Say what? This is like saying that once you know what all the commands in Illustrator do, you're well on your way to being a professional illustrator. The reason that K&R is so small is that so much of C programming happens outside/…

@tptacek and others on this thread, what books do you suggest to learn modern C programing? I am an experienced programmer, but all of my experience has been with JVM languages. I would like to be able to read and debug C/C++ programs - so which books provide a good start on idioms, libraries and tools?

It's not exactly a book suggestion, but hacking on the Linux kernel can give you experience with a sizable code base in reasonably good C. If you are or want to be a Unix developer at all, become good friends with the man command and make sure you have the complete set of manual pages installed (and, ideally, the POSIX original man pages as well to compare your system to the spec).

Re: 32 years on, K&R's "The C Programming Language" still stands alone

#70
post #65

Earlier quoted context omitted.

Kneejerk downmodding has become somewhat epidemic recently (in the last few months?). Most of the time more thoughtful users tends to correct this problem later on, though.

It probably helps that downvoting is only possible for newer posts (at least from my perspective), while upvoting is always possible.

I usually compare on what I think a comment is worth and what it has at the moment, and then vote to make the `is' closer to the `should'. At least for upvotes. In generally I only downvote stuff that lowers the quality of discussion.

It would be interesting if we had a voting system, that worked a bit like eBay's `bidding agents'. I.e. a system where you vote by setting a target score, and the system casts an up- and downvote as necessary. Of course we would need those base-votes to be recastable (but only automatically).

The current system is a special case of this, where the target score is either plus infinity or minus infinity, and you can't change the target score once set.

P.S. Please forgive my off-topic ranting in this discussion about K&R.

Post reply on HN