Back to the bookshelf

Typographic jacket · original cover not fetched

FROM THE SHARED SHELF · 2006–2026 SAMPLE

C Interfaces and Implementations: Techniques for Creating Reusable Software

David R. Hanson

2 readers recommend it across 1 discussion

Topics are model-inferred labels.

Keep it on your reading list

THE WORD OF MOUTH

What made it worth passing on?

Original Hacker News comments, in the readers’ own words.

chubot
I read the Hanson book ~10 years ago (he was briefly a coworker). It's interesting, and maybe worth checking out for experienced programmers, but NOT for someone who wants to learn C in 2022 and be productive. The style doesn't match any C code you're likely to see. It basically presenting an STL-like set of data structures and standard library in C, not C++. That style of programming isn't idiomatic in C. One thing that took me a long time to realize is that C is NOT a modular language! The best way to use C is to roll your own (or copy and paste) data structures for your problem, not try to use canned ones! If you want the latter approach, C++ is better. It has better support for type safety, abstraction, and modularity (at great cost). i.e. if you compare code of commonly used codebases like Lua, CPython, sqlite, Redis, BSD kernels, Linux, etc. you will see patterns, and they don't look anything like Hanson's book
mhd
One can only learn a language one time, so I've got a hard time recommending first books. But I definitely second the recommendation for the second book here ;) Hanson's style is a bit idiosyncratic, with his somewhat Modula-3-ish naming style and literate programming use, but there are a lot of usable data structures in there, and I especially like that the focus is on the module level, not on the algorithms themselves. Now, having said that, if you're in a particularly weird sub-domain of C, books from there might supersede or at least color a lot of what you're doing on a day to day basis. In the days of yore, if you wanted to do Win16/Win32 programming, getting to work with your Petzold early is a good idea, and I would assume the same to be true if you do glib/gobject based Gtk programming. Two free resources that looked good to me and that I forwarded in the past were "An Introduction to the C Programming Language and Software Design"[1] by Tim Baily and "Beej's Guide to C Programming"[2]. Those are a bit more concise than your average intro to C book, but for some paths (prior experience, quick headway to C++ etc), they might be sufficient.…