7 ms·
The 2nd edition circa 1988 uses ANSI style declarations.
by sureshv 6y ago
The 2nd edition circa 1988 uses ANSI style declarations.
- pjmlp 6y agoAnd has never been updated ever since. Latest standard revision is ISO C17.
- Koshkin 6y agoThank god. I’d hate to see the book grow to a thousand pages.
- pjmlp 6y agoOn the other side it is full with outdated information and examples that lead to unsafe C code, not much to be happy about.
- saagarjha 6y agoName one from the second edition? I found the book’s examples to be fairly timeless.
- pjmlp 6y agoIt is 2000 km away from where I live. Not going to buy another copy just to make someone happy on Internet. But still, most examples don't proper error correction, don't teach about use of bound checked strings and vectors, and if I remember correctly there are examples with gets().
- saagarjha 6y agoI hear there are PDFs floating around on the internet, not that I would know anything about this of course ;) My copy has no examples that use gets, although it is mentioned and I would agree that any such mention without a disclaimer that the function is impossible to use safely is a defect. Error handling, however, is generally present (or left out for brevity and noted). The functions in the standard for dealing with bounds checks are a new addition to the standard and a pox on the language regardless so it's not the best example of something new that the book should cover.
- pjmlp 6y agoFor those that care about security in C, even those functions are not the way to go, rather something like https://github.com/antirez/sds https://github.com/antirez/sds. This is something that the book fails to teach, as it also has no mentions of modern static analysers practices, naturally given the book's age. So at the end we get yet another C newbie writing future CVEs.
- saagarjha 6y agoThose are both modern additions to the language, the latter of which I would say is a necessary part of any formal C education (I always mention "K&R with supplements" as the go-to way to learn C). Thus, I wouldn't call it "outdated" but maybe "incomplete"; all the information in the book is fairly up-to-date-but it is missing things that modern C programmers should know.