TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Deconstructing K&R C Is Dead (2015)

131 点作者 rebekah-aimee大约 9 年前

26 条评论

rhexs大约 9 年前
Low level languages are tough. Gaining a mastery of C does require knowing quite a few strange rules and quirks and it&#x27;s certainly a bit harder than learning Python. The C FAQ does a good job of illustrating some of the more confusing parts. Sure, I wish I could write Go instead, but that isn&#x27;t going to happen on the many embedded systems I work on.<p>This is a rather strange and insulting article. I&#x27;m not sure why Zed can&#x27;t help &quot;old programmers&quot; nor do I understand why he&#x27;s angered that individuals know about undefined behavior in C. Is there any background to this or did he have the misfortune of being insulted on IRC?<p>Edit -- I googled for a bit and discovered this was in response to someone doing a pretty good job technically reviewing the book for free! <a href="http:&#x2F;&#x2F;hentenaar.com&#x2F;dont-learn-c-the-wrong-way" rel="nofollow">http:&#x2F;&#x2F;hentenaar.com&#x2F;dont-learn-c-the-wrong-way</a> Perhaps the title was a bit inflammatory.<p>Zed&#x27;s rebuttal is at <a href="https:&#x2F;&#x2F;zedshaw.com&#x2F;2015&#x2F;09&#x2F;28&#x2F;taking-down-tim-hentenaar&#x2F;" rel="nofollow">https:&#x2F;&#x2F;zedshaw.com&#x2F;2015&#x2F;09&#x2F;28&#x2F;taking-down-tim-hentenaar&#x2F;</a> and is a great example of how not to react to constructive criticism. My favorite part is his safercopy function and the lack of size_t.<p>And finally, to leave us all with a quote from Zed&#x27;s rebuttal:<p>&quot;Over this next week I’m going to systematically take down more of my detractors as I’ve collected a large amount of information on them, their actual skill levels, and how they treat beginners. Stay tuned for more.&quot;<p>Wow.
评论 #11728161 未加载
评论 #11727986 未加载
评论 #11728153 未加载
barbs大约 9 年前
I can&#x27;t really speak for Zed&#x27;s expertise and&#x2F;or value to the programming community. From what I gather, a few of his projects are widely used (Mongrel comes to mind), and he seems to know his stuff pretty well. I also identify strongly with his Programming Motherfucker[0] rant.<p>But man, the guy is insecure to the point of requiring therapy or something. He seems obsessed with his image and status, and the slightest criticism will cause him to lash out in an immature and ridiculous manner. Past rants have him making lewd comments about penis-sizes and challenging others to a physical fight[1].<p>It&#x27;s a shame, because if he just relaxed a bit and took criticism gracefully, he&#x27;d probably find himself to be a bit more valuable to the community and employers, and would actually be a pretty decent dude. Instead, his writing seems to reek of a constant need to validate and defend himself.<p>This is probably an unfair comparison, but I can&#x27;t help but think of Terry Davis: a brilliant programmer hindered by mental issues. Schizophrenia is obviously not the same as insecurity, but I think the situation here is somewhat similar.<p>[0] <a href="http:&#x2F;&#x2F;programming-motherfucker.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;programming-motherfucker.com&#x2F;</a><p>[1] <a href="http:&#x2F;&#x2F;harmful.cat-v.org&#x2F;software&#x2F;ruby&#x2F;rails&#x2F;is-a-ghetto" rel="nofollow">http:&#x2F;&#x2F;harmful.cat-v.org&#x2F;software&#x2F;ruby&#x2F;rails&#x2F;is-a-ghetto</a>
评论 #11728022 未加载
评论 #11728202 未加载
评论 #11728427 未加载
评论 #11728143 未加载
评论 #11728136 未加载
评论 #11728094 未加载
评论 #11728978 未加载
pcwalton大约 9 年前
This is obviously a bitter rant, and devolves into uncomfortably ageist territory about halfway through.<p>I do agree that we should be moving away from C and C++, though. It&#x27;s pretty simple, really: C was a pretty good language in 1978. We didn&#x27;t know a lot of things in 1978 that we do now in 2016. It now makes sense to revisit those decisions in light of nearly 40 years of practice. The so-called &quot;PL Renaissance&quot; has given us a whole host of new languages which have steadily chipped away at the dominance of C and C++, and I think this is a healthy trend that ought to continue.
评论 #11728047 未加载
评论 #11728083 未加载
评论 #11727796 未加载
评论 #11728859 未加载
评论 #11728563 未加载
wyldfire大约 9 年前
I am one of the many stalwarts whose bookshelf contains a prominent copy of K&amp;R C. But over the last 10 years or so I find myself referring to it less and less often. It&#x27;s a huge problem that it stopped at the second edition. The 2nd ed was great in 1999. It is not great in 2016, it is only good.<p>&gt; &quot;You&#x27;re right, but you&#x27;re wrong that their code is bad.&quot; I cannot fathom how a group of people who are supposedly so intelligent and geared toward rational thought can hold in their head the idea that I can be wrong, and also right at the same time.<p>Zed, you&#x27;re right, period. But I think you probably just hurt people&#x27;s feelings because they revere Kernighan and Ritchie and this is <i>one</i> prominent item of their legacy.<p>&gt; But C? C&#x27;s dead. It&#x27;s the language for old programmers who want to debate section A.6.2 paragraph 4 of the undefined behavior of pointers. Good riddance. I&#x27;m going to go learn Go (or Rust, or Swift, or anything else).<p>Amen. The union of those three are likely to address all use cases that C handled in the past.<p>BTW the blog post would be clearer if titled: &quot; &#x27;Deconstructing K&amp;R C&#x27; is dead&quot;. Gotta love mixing up C with natural language operator precedence ambiguity. :)
评论 #11727806 未加载
评论 #11727715 未加载
评论 #11728442 未加载
评论 #11728043 未加载
jimbokun大约 9 年前
Maybe this made Zed feel better, but communicates almost nothing to any outside reader.<p>Not a single actual quote from any of his detractors, for the reader to judge for him or her self if their criticisms have any validity.<p>The categorical declaration of &quot;I cannot help old programmers,&quot; without providing the evidence he has for this claim. Lots of name calling, though.<p>No link to the original content, to determine for ourselves whether or not it was fair to K&amp;R&#x27;s work.<p>I suppose Zed just meant this to be personally cathartic, and didn&#x27;t realize he posted it on a public web site where other people can read it?
评论 #11727894 未加载
评论 #11728358 未加载
alexeiz大约 9 年前
I looked at Zed&#x27;s books but didn&#x27;t find them either containing much of useful material, or written well enough to be worth reading. Granted, I&#x27;m not a novice to subjects he writes about. But still, I find it peculiar that his high opinion of his works seems to be rather detached from reality. The books are written in a simplistic and sometimes demeaning style and it&#x27;s obvious that many people will not like it. But when someone writes an honest review, he seems to get too upset about it. While he obviously likes to critique other peoples&#x27; works (such as K&amp;R), he&#x27;s very sensitive to critique of his own books. Zed thinks that it&#x27;s acceptable to insult the reviewer (Tim Hentenaar) in response. Reading his response made me cringe. Insulting reviewers is just not what respectable authors do.
DLA大约 9 年前
Oh Zed. Really?<p>There is nothing wrong with carefully crafted C code for applications were it is the best suited tool. Sure, there are sharp edges. True you can write crappy, security nightmare code.<p>You do make some good points. I agree Go is fantastic. Rust is coming along as well. However, C still runs the world. That&#x27;s not changing anytime soon. Not with the explosion of IoT and GPU type devices. And, hello Linux kernel and all the glorious command line tools on nix.<p>Try using Go or Rust (love both, x2 for Go) to allocate say a hundred GB of memory for some huge&#x2F;fast in-memory data processing. Let me know how far you get.<p>Your rant is as polarizing as those who are blind to C&#x27;s flaws (yes, there are a few). Stop saying &quot;don&#x27;t write C&quot;, that&#x27;s just childish. Rather, what about &quot;let&#x27;s write better, less security flaw prone C.&quot;<p>As an engineer, one ought to choose wisely when choosing tools. This means pros and cons and balanced unemotional decision making. Not a holy war against a given tool.<p>And I am a professional programmer.<p>Let&#x27;s do C where C makes sense.<p>(Edit: fixed typos)
评论 #11732097 未加载
评论 #11731940 未加载
评论 #11730450 未加载
评论 #11734260 未加载
评论 #11728015 未加载
mark-r大约 9 年前
I went to the Internet Archive just to see what all the fuss was about. Hate to say it, but I agree with the detractors. He seems to be completely missing the concept of <i>preconditions</i>. If the preconditions are met, the code is good; if the preconditions aren&#x27;t met, undefined behavior occurs. Most people programming C or C++ for more than 10 minutes learn to pay attention to these things. The chapter would have been much better if it would have stuck to the importance of validating preconditions, rather than simply pretending they don&#x27;t exist.<p>Good riddance.
pfarnsworth大约 9 年前
To be perfectly blunt, C does not need Zed Shaw &quot;saving&quot; it. He can go ahead and ignore it or end his book or rewrite the chapter or spout his vitriol over how stupid C programmers are; nothing he does will make an impact.
评论 #11728090 未加载
bsg75大约 9 年前
&gt; I cannot help old programmers.<p>Unfortunate he uses this categorization. The problem is a mindset that can exist in any generation.
zvrba大约 9 年前
I&#x27;ve read&#x2F;maybe even briefly participated in a discussion about Zed&#x27;s book a couple years ago, and the technical debate went like this:<p>Z: K&amp;R&#x27;s strcpy is broken, e.g., you can forget to null-terminate the string. Mine is safer.<p>Ohters: It&#x27;s not broken, of course it&#x27;ll do something unpredictable if you break its preconditions.<p>Z: strcpy is still broken.<p>Others: Your function will break too if you pass it the wrong length.<p>Z: This cannot happen, K&amp;R strcpy is broken, mine is safe.
siegecraft大约 9 年前
Damnit, I was tricked into reading something by professional troll Zed Shaw. The hypocrisy of him complaining about &quot;the dark side of programming&quot; is hilarious consdering he is a very good example of that. His style of debate is to insult and call people names who have offered non-judgemental and constructive criticism and I&#x27;m sure nothing I&#x27;m saying is news to anyone who has a passing familiarty with him.
webkike大约 9 年前
K&amp;R C was my introduction to real programming. I treated it ever since as a book, not a reference. Does that make sense? For me it was a glance into the mind of the creator of the language. Yes, some of the ways of programming were flawed in a way that results in today in many terrible things, not the least in which is death. But I was able to outgrow K&amp;R, to learn better things, with its succinct language reference as my wings. I was fine not learning security oriented programming immediately. And I certainly enjoyed learning it with minimal snark and curse words. Maybe my method was harder, really? Learning things without you telling them to me? Maybe, don&#x27;t really care. Maybe people don&#x27;t like your essay because it&#x27;s essentially shitting on a reference to a language. That is what K&amp;R was in the beginning. It morphed into something else by your demands not the authors. Let my hero rest in peace. Learn to breathe. C is as dead as Latin is.
评论 #11728265 未加载
ori_b大约 9 年前
The specific section of his &#x27;Learn C the Hard Way&#x27; book that he&#x27;s referring to was mostly, as I recall, complaining that the C string functions defined in K&amp;R will fail when you don&#x27;t pass them valid data, and therefore, they&#x27;re fundamentally broken.<p>Make of that what you will, but it seems to me that given all of the other ways that C can blow up due to programmer error, it seems reasonable to expect programmers to pass a valid string to a string function.
评论 #11728540 未加载
评论 #11728145 未加载
cognivore大约 9 年前
I have mixed feelings about this, but I cannot disagree with it.<p>a. I haven&#x27;t written a program in C in over 10 years. I wrote software 5 days a week for those 10 years.<p>b. I wouldn&#x27;t want to write a program in C now.<p>c. The first &quot;high level&quot; programming language I learned was C, from a book (not K&amp;R C), while travelling in Asia, without a computer. It taught me well, but I immediately went on to other languages.<p>e. I can&#x27;t shake the idea that there is some value to knowing that low level stuff, even though I don&#x27;t use it much myself.<p>Maybe linux kernel hackers will keep it alive. I know game programmers use it a lot as well. But for the majority of us, it&#x27;s kind of an arcane skill now.
评论 #11728091 未加载
评论 #11728132 未加载
评论 #11727892 未加载
评论 #11728039 未加载
silent90大约 9 年前
I&#x27;m sensing a huge incomprehension in a great amount of posts. The key is to know the purpouse of tools. C is a &quot;close-to-the-metal&quot; type language. You can control a low-level things, execution time, &quot;number of hops&quot; when writing data, etc. If you want a friendly language with &quot;no segfaults, no memory leaks&quot; then go higher level (which in many cases is a better choice, i.e. a GUI desktop application with no performance constraint). If you have a problems wrigint in C then you simply still can&#x27;t C and using the wrong tool for the task.<p>&quot;But C? C&#x27;s dead. It&#x27;s the language for old programmers who want to debate section A.6.2 paragraph 4 of the undefined behavior of pointers&quot;<p>Someone has to build the low-level stuff. Dear boys in too-tight pants and a hippie mustache: your high-level things and gluten-free snacks does not grow on trees.
评论 #11728730 未加载
markhahn大约 9 年前
joke? the author is self-important in precisely the way that K&amp;R weren&#x27;t.
kinkdr大约 9 年前
You had my sympathy until I read the &quot;error prone <i>shitty</i> language like C&quot;.<p>Next time before getting pissed off about the response you get, think what could it be that you have said or done that may have triggered it.
ipsin大约 9 年前
To me, C is like PHP (ignoring for a moment that PHP was written in C).<p>You can document its shortcomings, its dangers and all the headache-inducing choices. But while you&#x27;re doing that, people all over the world are building wonderful and terrible things with it.<p>So you&#x27;ve moving on to Go or Rust? Great! Good choices! But remember that there are people who may disagree <i>and be wrong</i> and also do something interesting with that wrongness.
评论 #11729004 未加载
meritt大约 9 年前
FYI, this rant is from January 2015. Surprised to see it showing on HN today.<p>If anyone is interested in what he removed, you can find it here: <a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20150101224641&#x2F;http:&#x2F;&#x2F;c.learncodethehardway.org&#x2F;book&#x2F;krcritique.html" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20150101224641&#x2F;http:&#x2F;&#x2F;c.learncod...</a>
评论 #11730601 未加载
评论 #11728469 未加载
dschiptsov大约 9 年前
K&amp;R taught fundamentals and a good style. It is timeless classic, because the principles doesn&#x27;t change within successions of mass hysteria.<p>Plan9 dialect of C is another example. There is portable mk package, with includes core libs (libbio, libutf, etc. which also served as core libs for earlier versions of Golang) to appreciate what C supposed to be.<p>I would paraphrase - attention seeking by attacking classics is a poor style.
评论 #11728664 未加载
lkrubner大约 9 年前
Do remember that this guy wrote:<p>&quot;I’ve more or less kept my mouth shut about some of the dumb and plain evil stuff that goes on in the Rails community. As things would happen though I’d take notes, collect logs, and started writing this little essay. As soon as I was stable and didn’t need Ruby on Rails to survive I told myself I’d revamp my blog and expose these fucks.&quot;<p>and:<p>&quot;After Mongrel I couldn’t get a gang of monkeys to rape me, so forget any jobs. Sure people would contact me for their tiny little start-ups, but I’d eventually catch on that they just want to use me to implement their ideas. Their ideas were horrendously lame. I swear if someone says they’re starting a social network I’m gonna beat them with the heel of my shoe.&quot;<p>So that is very much his style of writing.
评论 #11728456 未加载
评论 #11728173 未加载
评论 #11728174 未加载
Yuioup大约 9 年前
Punctuation seems to be dead. It took me a while to understand the title.
twblalock大约 9 年前
Lots of insecure butthurt and resentment in this article, and not much substance.
gravypod大约 9 年前
I can&#x27;t see how you could say C is dead when there isn&#x27;t really anything that can replace it.<p>I&#x27;ll take it as dead when the Linux kernel, or it&#x27;s futuristic replacement, is written in something other then C.<p>If you are talking about at the user-space level, then yes I can see that. But you shouldn&#x27;t assume your single use case, higher level user space apps, is the only use case.
评论 #11727871 未加载
ExtremisAndy大约 9 年前
This childish rant is embarrassing. With millions and millions of lines of C code basically running the internet and of vital importance to countless devices, calling it a s<i></i>*y language is beyond ridiculous.
评论 #11727881 未加载