10 ms·
There was a very good critique of K&R in Learn C the Hard Way that got taken down because of (IMO) undue backlash. The gist of it was that K&R ignores the safe
by loumf 12y ago
There was a very good critique of K&R in Learn C the Hard Way that got taken down because of (IMO) undue backlash.
The gist of it was that K&R ignores the safety problems in C and there is no discussion of the habits/constructs seasoned C programmers have developed to make sure their code is safe. Of course, many of those habits were developed after K&R, but that's why we need revisions and new sources.
In its place, Zed Shaw (the author), updated Learn C the Hard Way to concentrate on using C safely -- it is an awesome way for a newbie to learn C. Even if you don't agree (and want to use K&R), read this alongside it.
http://c.learncodethehardway.org/book/ http://c.learncodethehardway.org/book/
- __revrs__ 12y agoThen maybe it would be a good idea to go ahead and read K&R and then afterwards read Zed's book?
- loumf 12y agoK&R is a seminal work. I think it should at least be read because every C programmer has read it -- and so you are on common ground. Also, it is a better reference (has the grammar, precedence tables, etc.) To learn C -- I'd recommend LCTHW.
- fierycatnet 12y agoInteresting, last time I asked on various C boards about learning resources, Zed's book got ripped apart. http://www.iso-9899.info/wiki/Books http://www.iso-9899.info/wiki/Books
- FraaJad 12y agoThe critique of ZedShaw's book appears to be > Too many factual problems and a presentation that gets you to do things wrongly before being shown how to do it correctly, and not even always then. Eh?? Isn't that the whole point of "Learn __ the Hard Way"? ie., by making mistakes and learning from them?
- loumf 12y agoAlso, K&R does many things the wrong way for expediency. It's fine if you know that already, but newbies do not know that. The main critique of Zed seems to be that he didn't say it was impossible to protect a C function from the caller. So what? There is a big difference between his suggested style and the style you'd get from an uncritical reading of K&R, even though neither is 100% safe from the caller.
- zedshaw 12y agoThe man who moved my book into the "avoided" category admitted to me in an email that he did it just because of my K&R critique, not because of the book's quality, is not a C programmer, hasn't coded C professionally ever, and works doing PHP with almost no C experience.
- EpicEng 12y agoIt is shocking to me that someone who doesn't even use C is handing out critiques of any book focused on C.
- fierycatnet 12y agoYeah I am not picking sides here but they really sold me against your book on freenode. As a newbie I didn't know any better. Come to think of it, I was doing just fine following your book, until I went on #C at freenode.
- antimagic 12y agoIf your goal in learning C is to write largish systems in it, then yes, "Learning C The Hard Way" is a good option. But the poster has said that s/he wants to learn for the purpose of reverse engineering. From this point of view, the main interest of C is just learning enough syntax to be able create functions and structs, and then compile them with gcc -S, so that you can see the assembly language that is generated by the compiler. Personally I feel that pretty much any of the typically-cited C books are too heavy for this purpose. What you really want is a Learn C in 21 Days type of book, that will walk you through the build system as well as the basic of the C language. Even that may be too heavy - a well-written online tutorial would probably be a superior solution. Sadly, I haven't needed to look at "Intro to C" material for a very long time, so I can't really comment on what might be appropriate resources available these days.
- SCHiM 12y agoWell if you want to start reverse engineering, I'd think you'd need a very deep understanding of C. When reversing it doesn't help you if you know what a single instruction is doing. You need to be able to recompile the program in your head, and translate it back to high-level logic. You need far more knowledge of C than just the 'learn C in 21 days' stuff if you really want to start reverse engineering.
- RyanRies 12y agoI didn't know of the critique of K&R in LCTHW that got taken down. I'm surprised that the rabble-rousers weren't able to take it in context. When K&R was first authored, there were no "seasoned" C programmers from which to draw on for their experience in writing safe, secure C code!
- billrobertson42 12y agoYes and no. Perhaps when the first edition was published that was true, but the second edition was published 11 years later.
- greenyoda 12y agoWhen the second edition was published in 1988, there were seasoned C programmers, but security wasn't nearly the issue it is today. Since there was no World Wide Web yet, most computer systems weren't exposed to a global network full of people who wanted to crack code for profit. There was no e-commerce, no on-line banking, etc.
- claystu 12y agoWas the Morris Worm, which brought down a huge percentage of Unix Servers in 1988, the result of C? In any case, there was definitely a network that was being used by a lot of people by 1988.
- greenyoda 12y agoI think you're overestimating the impact of the Morris Worm - there weren't all that many servers to bring down. The first commercial ISP in the U.S. was founded in 1989.[1] Until then, only a few people in universities and the tech and defense industries had access to the internet. According to this chart[2], the number of internet hosts in 1992 is barely distinguishable from zero on today's scale. [1] https://en.wikipedia.org/wiki/Internet_service_provider#History https://en.wikipedia.org/wiki/Internet_service_provider#Hist... [2] https://en.wikipedia.org/wiki/File:Number_of_internet_hosts.svg https://en.wikipedia.org/wiki/File:Number_of_internet_hosts....
- citrin_ru 12y agoThere was a very good critique of "earn C the Hard Way": http://hentenaar.com/dont-learn-c-the-wrong-way http://hentenaar.com/dont-learn-c-the-wrong-way
- cnnrjcbsn 12y agoI'm biased, I have used Zed's books many times, but I found that critique to be far more detailed than it was "good." I got the impression that the author perverted Zed's writing just to take shots at it. LearnCTheHardWay, like all of Zed's other books is of the "write the code first, try to figure out what's going on your own first, and then I'll explain it to you" style. I get that some people don't like that, and if you were just learning how to code, I could see how the C book would be particularly annoying, but he clearly states it's not for people new to code. Mr Hentenaar also can't seem to make up his mind as to how he would like a how-to book to be written. In the first couple sections he complains there isn't enough detail, and then as soon as printf() is introduced, he is whining about the fact that every line of code was explained. Further, as he complains that Zed does with K&R, Hentenaar takes a lot of LCTHW out of context to show why it is "wrong" (such as the "make is the new python" example). Maybe he's trying to be meta in the way he wrote the review, but I doubt it. As a side note, it is (nearly) impossible for something that hasn't changed in almost 30 years (k&r) to keep up with something as dynamic as a program language. Even if the standard hadn't changed, the way a language is used is practically guaranteed to change over a period that long. Although, as somebody else said, the exercises in k&r are great and it covers a lot of interesting information, but does seem pretty light.
- zenlot 12y agoTo criticize like Zed Shaw is easy, but create something which would be used around the world for so many years - a different story. That critique is just not respectful marketing to promote the books which isn't very good by itself.