News for hackers. Stuff that matters.
Re:C Programming Guidelines by ggreer on Wednesday September 02, 2015 @12:34AM (#10157443)
I'm the author of The Silver Searcher (aka ag)[1]. I wrote my first C program almost 20 years ago, and I have some not-very-nice things to say about this guide. I hope the author won't take it personally.

First, Zed Shaw's Learn C the Hard Way is not worth reading. I agree with most of Tim Hentenaar's criticisms.[2] It's confusing, incomplete, and overly opinionated. If you want to get started with C, read the K&R book. It's not perfect, but it's better than anything else I know of.

As for the guide itself, the quality of its advice varies greatly. Some bits are great. Some are good. Some are controversial. Some are dangerously double-edged. And some are Not Even Wrong. It would take too long to go into detail, so I'll just say: Please don't blindly follow this guide. Explore other codebases (including the ones the author linked to). Talk to other programmers. Write your own projects, and get feedback from those who are more knowledgable.

You might notice that this advice generalizes to every language. That's because C isn't special. If anything, the language itself is simpler than most. C has just had more time to accumulate cruft, both technical and cultural. So don't feel intimidated. Once you learn those bits of historical trivia, you'll be fine.

1. https://github.com/ggreer/the_silver_searcher

2. http://hentenaar.com/dont-learn-c-the-wrong-way

Re:C Programming Guidelines by btrask on Wednesday September 02, 2015 @06:28PM (#10162326)
Thanks for for the comment. I'm the author of the article. I'd really appreciate some more specific feedback, particularly the parts that you think are dangerous or "not even wrong."

I'll take a look at the Silver Searcher's code and see what pearls of wisdom I can gain.

Re:C Programming Guidelines by ggreer on Thursday September 03, 2015 @02:50AM (#10163631)
In hindsight, my comment seems rather curt and dismissive. Thanks for taking my criticisms like a champ.

Honestly, I don't think ag is very good code. It's worth reading if you want to see optimizations like memory-mapped I/O, pthreads, Boyer-Moore strstr, etc. But if I had to grade the quality of the code, I'd give it a C-. Many parts have grown organically, and I haven't had time to restructure them. Also, ag's use-case is not exactly mission-critical. Nobody is going to die if it crashes or errors-out. Add my time constraints and… the result is some shoddy code.

I'll add "C Programming Guidelines" to my queue of blog posts to write, but I make no guarantees about when I'll get to it. Sorry.

Re:C Programming Guidelines by btrask on Thursday September 03, 2015 @06:25PM (#10167873)
Cool, I'm looking forward to it.
Re:C Programming Guidelines by fit2rule on Wednesday September 02, 2015 @01:43AM (#10157615)
I concur .. another good book that will teach you more about C in a productive way, is "Expert C Programming- Deep C Secrets":

http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...