Hacker News new | past | comments | ask | show | jobs | submit login
“Learn C the Hard Way” is no longer available for free (learncodethehardway.org)
67 points by striking on Sept 11, 2016 | hide | past | web | favorite | 85 comments



If memory serves, the web version was always sort of an "alpha". The book now has a physical print edition, so I guess he wants that to take priority.

Kind of a bummer, but fortunately I already worked through the book when it was in alpha and saved a copy of all of my exercise solutions in case I need to refer back to them in the future.

EDIT: Looking at an Archive page reinforces my view on this: http://web.archive.org/web/20150203094342/http://c.learncode...

"This is the in-progress free version of Learn C the Hard Way."

So my understanding is we were basically beta-testing his book for him and providing feedback in exchange for his making it free. He's finished it, smoothed it out, and finalized it with some additions and videos, so now he wants money for it. Seems fair enough to me.

I've seen the physical edition at Barnes and Noble a few times. I might thumb through it one day and see if there's enough content beyond what I pulled from the alpha to be worth buying.


I just bought this book two days ago and I'm loving it so far. Apart from the last few chapters that are now complete, you also get videos of Zed discussing the code and exercises.

For the insane amount of work Zed's put in the material, I consider it a very worthwhile purchase. Given the tremendous amount of value I've derived from Zed's other free books, parting away with the $30 is the least I could do to support his efforts.

Thanks Zed for this excellent resource!


The one in "Stuff that should be avoided"?: http://www.iso-9899.info/wiki/Books#Stuff_that_should_be_avo...


IMHO, that's the best endorsement for the book I've ever seen. Zed had a knack for pissing off people who spent too much time in theory and too little time building things.

I don't blame him for finally charging for it either. It's a good book and giving it away for free got him nothing but harassment and libel.

update: Beej's Guide to C[0] is also on that list.

[0]: http://beej.us/guide/bgc/output/html/singlepage/bgc.html


This is the reason they gave to avoid it:

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.[0]

[0]: http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_be...


Yeah, but this is ##c: when they say "factual problems," they mean that at some point Zed said that a function took an array as an argument, or that the book didn't match up to the letter of the C standard. And "doing things wrong" means not checking the return value of every single syscall you use.


>And "doing things wrong" means not checking the return value of every single syscall you use.

There are people who think not checking every syscall is a good idea?


No, of course not, but they're a bit extreme about it.


I was just stating a fact, regardless of its actual validity.


#c doesn't spend their time on theory. They spend their time genuflecting before the C standard.


##c is the single most pedantic internet forum I've ever been in. Also the only time I've seen someone spell "coördinate" with the Diaeresis in chat was in that channel.


That sounds like ##c.


Beej's book isn't on the avoid list, it's on the free books list.


It's on the full list[0].

  Beej's Guide to C: http://beej.us/guide/bgc/output/html/singlepage/bgc.html
  Full of mistakes.
[0]: http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_be...


Ah my mistake.


They said the same thing about Build Your Own Lisp In C, and many other books. These are the people who worship the C spec, and will crucify you for daring to claim that your function takes an array as an argument. I'd take anything they say with a grain of salt.


That list is maintained by some of the Freenode C regulars. Anyone who has spent time on Freenode C knows to take anything they say with a grain of salt.


...which was my point. Freenode #c knows their stuff, more or less, but you follow the same rules you do around Erik Naggum or /g/: keep your head down, be cautious, and show no weakness.


http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_be...

The whole thing seems kinda snarfy and out-of-touch. It's basically single-sentence "Oh this is totally not worth it", which is usually a sign of people on the 'net jerking themselves off over how elite they are. It's just a bunch of folks on IRC showing off.

They pan a nice book on implementing a lisp in C and a simple guide from Beej (of Beej's Guide to Network Programming).


"people on the 'net jerking themselves off" is a pretty good descriptiob of freenode's ##c. I'll quote Daniel Holden (the author of the book on implementing a lisp you mentioned above)'s words on the matter[1]:

This channel is hardly known for being friendly. Generally anything other than K&R is regarded as Socratic corruption. And not checking the return value of malloc is on par with adultery. Nor do they have much concern for encouraging the next generation of C programmers. I remember witnessing a new C programmer ripped for several minutes on the channel for simply mentioning the heap and stack in their explanation. Instantly he was shot down with "implementation detail and not defined in the C standard" and told to ask his question in #unix. The channel is generally a great place to go if you want to be told you're an idiot.

1: http://www.theorangeduck.com/page/ready-fight


Zed Shaw's books remind me of Herbert Schildt. In fact, Schildt is also on that "to be avoided" list! Books from both authors are practical and interesting to read, but contain serious mistakes and omissions. Back in the days I learned C from one of Schildt's books, and I thought it was very useful. But now that I know better, I'd never open that or any other books he wrote. I guess, if you don't have any knowledge, such books look very appealing as a starting point. You quickly pick up some basic knowledge and practices. But later, it may actually be hard to unlearn all the wrong things that these books teach.


Same is said for his Python book as he discourages Python 3; 'Automate the Boring Stuff' is also free and superior


Thanks for the heads up!

http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_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."


Be careful taking standards group weenies too seriously.


I have to be honest: the fact this is in "things not to read" from ISO is one of the strongest endorsements I could imagine. For that to happen, it must both be successful enough to get on their radar, and also to tick them off.

That said, I know why this is on the list. Zed honestly doesn't like C, by which I mean that he recommends a lot of things that are (in my opinion) genuinely best-practice, but fly in the face of either historical norms, or the techniques that the ISO C team wants to push. Depending on what you're aiming for, this might indeed make it a bad work—but it can also make it a great one. I'd liken it in some sense to DJB's projects: Zed recommends a fairly unorthodox, but (again, in my opinion) excellent way of writing C. If you need to interface with people who write C the way most people write C—you're working on an operating system, perhaps, or a legacy codebase—this may be a problem. If you're writing C because you need to write a few components of your project in C for performance or [lack of] abstraction reasons, and would prefer not to hate yourself later, it's great.


The problem here is that Schildt's books really aren't good.

But as far as LCTHW goes: I doubt very much its author has the same objectives for writing a book about C that the standards weenies do, and I doubt very much that they took that into account before warding people away from the book.


It's not ISO: that's from Freenode ##c. It's likely they just hate it because Zed got a trivial detail about the C standard slightly wrong, rather than because they're trying to persecute him or something. It's more their style. Zed's the one who's more likely to be persecuting someone.


Just to be clear that website has nothing to do with the official ISO. Or the ISO C working group.


Can you imagine DJB deliberately teaching how to do something wrong before teaching how to do it right, though?


I can imagine him deliberately writing something wrong before not writing it right (i.e. Qmail).


Someone who would ding one of the two best MTAs ever written (the other of which inherited its design from qmail's) because of its indentation and variable naming style says more about themselves than about qmail.


Someone who considers Qmail one of two best MTAs ever says more about themselves than about Qmail. If it was that good, why would it effectively die? Virtually nobody uses Qmail anymore.

Not to mention that Qmail is (well, was at some point) one of two biggest sources of wild workarounds in all the other MTAs, the other being MS Exchange. DJB took standards and implemented their subset that suited him.


I am very comfortable with what qmail appreciation says about me as a programmer.


What's so awful about qmail? It's pretty solid, last I checked.



If that's from the freenode ##c wiki, you should probably take that as a ringing endorsement.

##c is laughable. I'm not sure they actually use C, or just think about the C Abstract Machine and Glorious Specification.


I've already quoted Daniel Holden on ##c once under GPP, but his evidence on the matter, deserves, I think, a repost here:

I remember witnessing a new C programmer ripped for several minutes on the channel for simply mentioning the heap and stack in their explanation. Instantly he was shot down with "implementation detail and not defined in the C standard" and told to ask his question in #unix.

You can find the whole article at http://www.theorangeduck.com/page/ready-fight.


The funniest part is that the C in K&R is not really much different, let alone better, than in any of the books they recommend against. I guarantee K&R would be on their list of books to avoid if it wasn't written by… well, K&R.

I've used & contributed to Daniel's stuff (mostly mpc¹) and his code is (IMO) quite high quality. ##c is a bit deluded.

¹ https://github.com/orangeduck/mpc


##c isn't a bit deluded.

They're very deluded.


I thought it was pretty good.


https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html

This is my favorite C related documentation online. The first book on C I read was a PDF of K&R, I liked it. I used to think the paperback was way too expensive. Instead I bought C Primer Plus, never read it. Few books capture the gist of a language as well as K&R in as little space. Though Modern Perl and Programming in Lua also come to mind. If they ever make an updated version of K&R I would definitely buy it.


>I used to think the paperback was way too expensive.

How much was it?


Around $50 USD in Amazon, like today. I just thought it was too much for the quantity of pages. But really, few programming books are as good as K&R. I still think the editorial is particularly greedy when it comes to this book. Still I don't recommend any C book, other than K&R.


If you want to buy a cheap printed version search on abebooks.com. They usually have international editions at competitive prices. I used to buy all my college textbooks from there.


Decades back when I was a competent C programmer, I liked Harbison and Steele's C: A Reference Manual. https://en.wikipedia.org/wiki/Guy_L._Steele_Jr.#Books


>But really, few programming books are as good as K&R.

Agreed.

I asked about the price because it is, or at least used to be, a lot less expensive than that, in India, from the time when I first bought a copy (when first learning C, near the start of my career), to at least some years ago, when I bought several copies of it to give to the students of a C course I was conducting for a company. In that whole period it was just a few hundred rupees (INR) in price, which is just a few USD (under $10 or so, even with the change in exchange rate over the years). I do know that publishers have variable pricing for different countries, of course.


I really enjoyed reading this book when I was re-learning C. I don't understand why It gets so much hate, the book gets you coding complex programs in a couple of days, unlike other C books where you have to read 300+ pages to finally start learning about pointers.


What C book has 300+ pages before you learn about pointers?


I went and checked - the book I first learned from, "Using C" by Clint Hicks, didn't introduce pointers until page 232. Not quite 300+, but not too far off either.


I read it a while back and didn't think it was very good. I wouldn't pay $30 for it IMHO. There are better books out there.


I don't really give too much of a shit about this particular book, but this logic is, to me, amazing.

It's a book about programming --- a very specific kind of programming. The only reason for normal people to read is to acquire some new set of skills.

I am having a hard time thinking of any --- literally any --- new C programming skill I would value at less than $30.

That doesn't mean you can't reasonably warn people off a book! It might not be worth the time to read. It might be totally inaccurate, or fail to communicate any new skills. But otherwise, "I wouldn't pay $30 for it" wouldn't make sense even if the book were just 5 pages long.


it does if there is a better book available on the market for $20.


Most of the cost of the book isn't even its price, it's the time wasted going though it if it turns out to be bad. Or worse the time spent unlearning it if it's out of date, incorrect, doesn't follow conventions, or doesn't follow best practices.

I'm incredibly wary of just about any textbook that isn't an official reference for this reason.


If I offered you a BMW M5 for $2000, would your first thought be, "hmm, I should check to see if someone is selling the same car for $1800"?

Programming book preferences are fine, useful even! Complaints about book prices are silly. Take your career more seriously.

I guess my point is just: pretty much all technical books are fantastically, comically underpriced.


> If I offered you a BMW M5 for $2000, would your first thought be, "hmm, I should check to see if someone is selling the same car for $1800"?

Firstly, probably yes. If you're selling way below the market price, there's something wrong with your BMW. But leaving that aside...BMW M5s are not nearly not as easy to produce or copy as books. I could probably generate a (horrible) learn to program in C book in a matter of days and put it up for sale for $30. I would appreciate someone telling the world "Don't buy this, it's a bad idea."

Now I maybe you have already read the book and know it's not particularly bad, or you think Zed's reputation as an author is good, or something else like that – and it's fine to offer those as rationales for buying the book. But the argument that "Any book about C is likely to change your career* and you're quibbling over $30?" is a terrible argument IMO. The likely thing that happens with the average C book is that you read the first 10 pages, can't grasp some point that the author is particularly bad at explaining, and wander off to watch a Youtube video or something.

Now if your book is so engaging that it prevents this sort of attention wandering, that is a book where you can reliably present this argument. One example (from my perspective) are the Feynman Lectures on Physics. I can read them for ages and ages without getting bored. If you or anyone else in the thread knows about that kind of C book, let me know. K&R (surprisingly) is the closest I've come.


Just to be clear/pedantic:

If I offered you a $100,000 car for $2000, your first instinct would be to see if you could get it cheaper?


You are saying the value to the buyer is far, for more than the cover price.

I agree completely; it's a really important point.

But not everyone on HN is a professional programmer, and there are students, self-improvers, and individuals in other countries for whom the sentiment of "just buy it; it's sufficiently valuable to you" is tempered by the opportunity cost (yes; the opportunity cost of $10) and the need to get the best value/dollar.

This is probably why poverty is so self-sustaining: because you have to burn ridiculous effort over trivial nonsense. Your thin budget gets even thinner, and now you're stuck.


Thinking more clearly, no. You're right, I would just take the $2000.

But...as I pointed out in my previous argument, a book is not comparable to a BMW, acquiring a new skill is. "$30 is cheap for acquiring a new skill" depends upon the premise that the $30 has some potential towards acquiring the new skill (which would depend upon some evaluation of the author and the book contents). Otherwise it's just an "I have $30" iPhone app.

Actually I think I could put it this way better – if I tried to sell you a $2000 lottery ticket with a BMW as a prize, wouldn't you at least enquire around and see if you could get one cheaper?


>Complaints about book prices are silly. Take your career more seriously.

Not everyone is a professional developer in an advanced economy, I am neither. Some books I've bought, have costed me as high as 25% of my monthly income. Also I am not talking about Tanenbaum hardbacks, I have never bought a book that expensive.


But a BMW M5 is a good car. Sorry but I don't get your comparison.

I will happily pay £100+ for a good book but I don't feel Learn C the Hard Way is worth buying at $30 when you can get better books for less.

Would you pay $100,000 for a junk car when you can get a BMW for $50,000 that is better in every way?


Problem is that if you are new to C, you might not know which ones are the better book. If you don't need C and need to tool up in a week, it's best to spend that $30 and learn what you can than lose some days trying to figure out what the best book is. Plenty of times, good enough is good enough.


Yes I could have phrased that better, I don't think it is a good book and I wouldn't recommend anyone buy/read it. Does it have some good content? Sure but overall I don't think it is a good book to teach someone C.


What are good modern books on C nowadays?


Personal opinion - (in order from beginner)

* C Programming Absolute Beginner's Guide by Perry and Miller

* C Programming A Modern Approach by King

* Programming in C by Kochan

* C Primer Plus by Prata

* Head First C by Griffiths & Griffiths

* 21st Century C by Klemens

* Understanding and Using C Pointers by Reese

* Expert C Programming - Deep C Secrets by van der Linden


Interesting list. Not worked much on C recently (though I am some on D these days), but had used it a lot earlier. I first started with K&R (not because I knew it was good or the best then - IMO, maybe some will not agree, and it may not be the best for a beginner), but because it was the only one available at that time and place, IIRC. Later I did read some other C books. I think the Kochan (Steven?) one you mention was one of them, and maybe also the Prata book. IIRC, the Kochan one was good. One book I read had an example of creating an index or concordance of a text file or program, maybe it was Kochan. Remember enjoying the logic.


You were not the first person to suggest Klemens's book to me, but after reading it, I disagree with most of it.


Did you read the first or second edition? The first edition had a lot of issues, the second edition was a lot better.


I'll have to check; it's on my bookshelf at work.


First edition.


Yeah the first edition wasn't so good. It got quite a big re-write for the second edition which came out quite quickly (in terms of a C book getting a second edition anyway).


why ?


It's hard to put my finger on exactly what it is I don't like about it. After rereading the table of contents I certainly don't disagree with some things (gdb, valgrind, version control, package management, are all good things).

I think my biggest beef is it seems to approach C as if it is a general purpose language, and I would argue that in the 21st century C is no longer a general purpose language. It is at its best now when used for systems programming, embedded programming, and making portable libraries (and the last is also no longer the exclusive domain of C, as besides C++ there are a couple other languages that can export C abi compatible functions and have unobtrusive runtimes).

Also, Klemens seems to like autotools. I don't hate autotools as much as others, as I remember a world before autotools was ubiquitous and it truly sucked. However, the combination of compilers not sucking like they used to (if you are using C99, you have a lot more features than you did on some crappy PCC derived vendor supplied compiler, even if you stick only to pure C99, and the odds of your compiler not "just working" on the C99 code is pretty slim) means that for simple projects a makefile that respects the CFLAGS, LDFLAGS, CC &c. is sufficient; for larger programs, there are serious alternatives to autotools. Obviously none of them are as dominant as autotools, but cmake is certainly prevalent enough to be a good place to recommend people start at.


I'm going to date myself here, but my first book was "Learning to Program in C" by Plum. It was an incredible beginners guide to C, but predates C89, so is a bit too dated at this point to recommend to people.

The same author also wrote "Reliable Data Structures in C" and I would love to update it for at least the features in C99 (C structs became a lot more useful at that point), as that book is a great read in that it walks you through the reasoning for doing things in a certain way, as well as providing the final result in code.


Ironically, the first customer testimonial I got on that page started with "Thanks so much for putting your book online."

I generally like stuff by Zed E. Shaw, though. Is there an official statement about this? Will he be making other books unavailable too?


I actually emailed the author about this. He is in the process of revising the site for C. It will be available for free, or so he told me.


For C++, there is a book called Accelerated C++ by Koenig and Moo. It was very enjoyable to work through it.


Their Ruminations on C++ book formed out of Koenig's columns is also excellent, if anyone is looking for an extra read. I have it on my desk right now :-)


How would you compare it to, for instance, Meyers' series of books?


Meyers is undoubtedly the master. Koenig certainly gives his own slant on things though and is enjoyable to read.


Yes, I got that book a while ago, soon after it came out, and really liked the approach. A very different, and to my mind, sensible approach to teaching the language to beginners.

Andrew Koenig was/is a C and C++ guru from a long time. Was at Bell Labs, IIRC, and worked with some of the original people who worked on C++, maybe, and worked on it himself.

I've read part of his C Traps and Pitfalls book, too - also good.


I've seen this referenced few times as a resource for learning C beyond the basics.

And my question for anyone who has gone through it, Is it worth the tag ?


Wasn't this partially crowdsourced?


From what I've seen the author sounds like an asshole that can't take criticism so I'm not sure I'd patronize his work either way.


https://github.com/davout/lcthw

it's still available for free in other locations, just search.


Yes, you can usually find illegal copies of recent books. HN tends to frown on such links, though.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: