News for hackers. Stuff that matters.
Re:C is 38 years old. K&R V2 is 22 years old. What's the bes... by tedunangst on Saturday November 13, 2010 @10:58AM (#1900994)
When you said style, I thought you meant where the braces go, as that's what a lot of people seem to complain about.

Now that you've elaborated, I'll certainly agree that it's not a tutorial for learning how to program, but I don't think it fails all that hard. And some of your criticism misses the mark too. None of the examples are substantive enough to warrant object orientation, there are no threads in C, etc. And ints that aren't 32 bits? When the book came out, tons of ints weren't 32 bits or even power of 2 sized. I never picked up that assumption from my copy. And I'm not aware of anything that won't actually compile.

The dangers of using bad functions is real, but the alternatives don't exist in the standard. It's unfair to complain that a book that describes the C standard only describes what's in the standard. C99 didn't change all that much about the language.

Re:C is 38 years old. K&R V2 is 22 years old. What's the bes... by gte910h on Saturday November 13, 2010 @12:18PM (#1901150)
>It's unfair to complain that a book that describes the C standard only describes what's in the standard.

It describes more than what's in the standard (namely, non-standard functions you could use to implement the standard). Other books describe the problem, and what you should do instead today (the entire point of this discussion is finding better substitutes to this very old book). My frustration comes from people hired to do C who think that book is cannon, when it's really more like "what was current in the early 90s".

I do get why you were originally reacting though. If I thought someone was just objecting to the brace style of the code I'd find that questionable as well.

Another thing which makes me really question the value of a C90 only book is that when confronted with things C90 doesn't do well (say, fixed sized types), you'll reach for C90 based solutions of the 90's to solve that problems (say, company defined type sizes and variable naming standards based on size), rather than the C99 solutions to those same problems, aka, the standards based solution to the problems.

I'd still think about getting K&R for perhaps the 4th book on C for a person (after something like Advanced Programming in the Unix Environment or _insert C language on platform of their choice_). Just not #1 anymore, and probably not #2.