TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Learn C the Hard Way: A Clear and Direct Introduction to Modern C Programming

37 pointsby hikzabout 10 years ago

4 comments

coldteaabout 10 years ago
&gt;<i>Let me start by saying that unlike Mr. Shaw, I am not a writer. I&#x27;m an engineer. </i><p>Such BS ad-hominen are not really need. As for the review, the first 12 paragraphs are empty blathering, and then we have empty criticisms that misunderstand the whole logic of the book. For example:<p>&gt;<i>So, finally printf() gets introduced. The author fails, in my opinion to explain what it actually does. This has the reader using format strings before even explaining (even briefly) what a format string is. This has become a repetitive theme in this book, and if I were a novice, I&#x27;d find it very confusing. </i><p>The whole idea of the book is that you learn by doing and repeatition first (like a kid does when learning to speak), and then you&#x27;re told the concepts and details.
评论 #9423729 未加载
评论 #9423723 未加载
评论 #9424447 未加载
kasabaliabout 10 years ago
<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>
评论 #9423567 未加载
评论 #9423750 未加载
评论 #9423784 未加载
评论 #9423773 未加载
评论 #9423717 未加载
sabootabout 10 years ago
Is there a table of contents anywhere? I remember wishing he finished the &quot;Let&#x27;s Make a Virtual Machine&quot; section at the end of the html preview of this book. It was never updated which was disappointing as it sounded really interesting.
comexabout 10 years ago
Of course this comment thread is (judging by the comments so far) going to be mostly about whether Zed Shaw criticizing old fashioned C is right or not or whether the criticizers are right or whatever. Oi... against my better judgement, I&#x27;m going to call out a few relatively objectively objectionable points in the book (which are still there, as opposed to the removed K&amp;R chapter):<p>- He repeatedly states that processing an invalid C string can loop infinitely, but it can&#x27;t - except in extremely rare cases on exotic systems, which seem to be the exact opposite of what he&#x27;s going for. In reality it will <i>always</i> crash (unless being exploited by an active attacker!). The hentenaar.com post already notes this, but this instance of him being objectively wrong is buried among a huge number of more stylistic and debatable points.<p>The error is not a big deal, since neither looping infinitely nor crashing is desirable, but I can&#x27;t help but think it demonstrates the author&#x27;s lack of experience in what he&#x27;s supposed to be teaching.<p>- Also wrong: &quot;The source of almost all bugs in C come from forgetting to have enough space, or forgetting to put a &#x27;\0&#x27; at the end of a string.&quot; Forgetting to null terminate is a newbie mistake. A claim that almost everything that can be incorrect about a C program comes from a buffer overflow seems obviously spurious, so I&#x27;ll give the benefit of the doubt and assume he&#x27;s referring to security problems. In that case, some bugs involve straight buffer overflows, but a good fraction of real-life security bugs involve other things like integer overflows and use-after-free.<p>Also not exactly a big deal - perfectly sufficient to worry about overflows just because they account for <i>many</i> bugs, rather than almost all - but it seems myopic with respect to real world code.<p>- &quot;In fact it&#x27;s so common and hard to get right that the majority of good C code just doesn&#x27;t use C style strings.&quot; I guess it&#x27;s technically subjective what counts as &quot;good&quot;, but most C codebases use C strings to some extent, so this is pretty misleading.<p>As one example, OpenSSH, despite being very carefully written code that uses a safe buffer API for the low level protocol manipulation, also uses C strings all over the place. As another, Linux is generally considered reasonably high quality, and it makes no effort to avoid C strings. I think you&#x27;d have a hard time making a long list of well-known C programs that <i>do</i> use alternative string libraries exclusively. (Note: this has no bearing on whether or not doing so is a good idea.)<p>- &quot;In C, there&#x27;s not really a &#x27;boolean&#x27; type&quot; - there has been since 1999; a lot of code doesn&#x27;t use it, but since this is aimed at modern C, are you really not even going to mention it?<p>- Type Conversion section doesn&#x27;t mention (or incorrectly describes, I can&#x27;t tell which) the &quot;integer promotions&quot;; these are an awful feature and relying on them is awful, but a manual for how implicit conversions are done shouldn&#x27;t have an incorrect algorithm!
评论 #9426569 未加载
评论 #9424439 未加载