top | item 20851370

Ask HN: Zed Shaw's critique of K&R

16 points| gilesgate | 6 years ago | reply

I've read of Zed Shaw's critique of K&R in "Learn C the Hard Way", and I've gathered that he had indeed raised an interesting range of issues, regardless of the backlash.

I've tried tracking that critique down to no avail. A link to Shaw's website that I found wasn't accessible,[0] nor was any archive.org copy of it.[1]

Does anyone happen to have a copy of or a link to it? I'd be interested in reading through it.

(Disclaimer: I'm not interested in refueling a debate, I just would like to read the critique or find out its salient points.)

[0] http://c.learncodethehardway.org/book/krcritique.html

[1] http://web.archive.org/web/*/c.learncodethehardway.org/book/krcritique.html

19 comments

order
[+] brudgers|6 years ago|reply
I can see why Shaw made the article less accessible via search. Shaw has done the same with other essays he wrote around the same time. The basic analysis is sound. If you write programs like those in The C Programming Language those programs will lack mitigations for buffer overflows and null pointers.

A weakness of this essay is it jumbles pedagogical and engineering considerations together for dramatic effect. The defensive code Shaw does not find in K&R is only justified if crashing is both likely and worth the effort to prevent. YAGNI and "let it crash" are alternative engineering approaches.

The strength of Shaw's essay is that the grappling with the absence of defensive programming motivated Learn C the Hard Way to introduce Valgrind and Make right away. And the outrage probably adrenaline fueled Shaw's writing. All the controversy was consistent with Shaw's public image at the time, to boot. But in the end, the essay, like many of the period, lacks nuance. Their fading searchability is probably a sign of Shaw's recognition.

I think Learn C the Hard Way is better for Shaw having written the essay and I think his book is a pretty good introduction to C programming in part because it introduces Make and Valgrind and eschews IDE's. K&R is also good, but it's written with the assumption that the reader is ok learning from material written in a documentary style. That's less common today than four decades ago.

[+] jdmoreira|6 years ago|reply
"Learn C the Hard Way" is considered by many to be a horrible book on C
[+] catacombs|6 years ago|reply
This.

Whenever I see "Zed Shaw," I steer clear.

[+] sverona|6 years ago|reply
I doubt my Google-fu is better than yours (and it looks like Zed has basically retracted what he said anyway by way of going so far to remove it from the Internet) but one of the salient points was definitely "some of the code in the book doesn't compile or do what it says it does."
[+] klingonopera|6 years ago|reply
One of his criticisms was the (usual) critique of C's null-terminated char arrays (to be precise, that failure to include an null-terminator in a char array causes overflow, thus functions needed to be designed to accommodate such cases), and another was stylistic critique, one with which I agree with ZS, that optional curly braces should never be omitted, no matter how mundane.
[+] antiquark|6 years ago|reply
Try google with "PDF" as part of the search term, there seem to be a couple of stragglers on the web.
[+] klingonopera|6 years ago|reply
Use "filetype:pdf" to limit results exclusively to PDF-docs. Works on DDG too.
[+] psv1|6 years ago|reply
Zed Python3-strings-are-too-difficult-for-me Shaw? I wouldn't bother with anything he's ever said or written.
[+] Nextgrid|6 years ago|reply
What's the problem with his Python book? I bought "Learn Python the right way" for a close friend as I thought it was a good one to get started - is it not?