3 ms·
What's wrong with K&R?
by Apocryphon 11y ago
What's wrong with K&R?
- brudgers 11y agoThere's nothing wrong with it, but it was written for the sort of people who were already employed in places like Bell Labs, so it sort of assumes familiarity with the way assembly code works. It's not so much that a smart person can't figure out how to write C code, but they will still have to pass arguments to the compiler or write a simple Makefile to get an actual working program.
- kazinator 11y agoFirstly, the K&R2 is outdated. It was published in 1988, a year before ANSI C. It has not been updated since. As a reference, it serves only long-time programmers who steadfastly stick to ISO C 90. The K&R and K&R2 can be likened to sales brochures for the C language, which promote the language to users of other systems programming languages and provide a mini-reference to get them started. I started learning C circa 1990 from K&R2. A few years later I started reading the ISO C standard and realized that much of what I knew was wrong. I had a "wow, so that's* how it actually is"* moment on what seemed like every page. It's not that the K&R2 explicitly teaches wrong things---obviously not; rather, it misguides the inexperienced by omission. You're expected to be an expert programmer who reads between the lines, asks the right questions about the limitations of constructs and consults a reference manual or standard to have them answered. The book is also not a tutorial on programming, either. Thus if you're a n00b, you will not learn programming from K&R2 and you will not learn C properly. A combination of K&R2 together with Andrew Koenig's C Traps and Pitfalls might be better. If you have those two books, plus the Harbison and Steele reference manual and a PDF of a draft standard, you're in very good shape as far as being well-informed. You still don't have a great tutorial though.