Review: C in a Nutshell

C in a Nutshell Front Cover

Click to buy on Amazon

For my birthday a few years ago, a friend of mine gave me this book for my birthday. And what a book!

For those not in the know, the O’Reilly publishing house has been putting out for a number of years now a series of books named the “in a Nutshell” books. These books are generally concise, well-informed references of the subjects they cover. They mostly cover technical subjects; C++, Python, SQL and Web Design all have Nutshell books devoted to them.

I now have a number of Nutshell books. I have all those I mentioned in the paragraph before, as well as a few others. I have a list as long as my arm of others I want (I plan to collect the entire series).

C in a Nutshell is written by Peter Prinz and Tony Crawford. I had never heard of either of these people before, but they are damn good writers. Unlike C++ in a Nutshell, C in a Nutshell is written well enough that my brain doesn’t hurt when reading it. I’m sure you know what I’m taking about: you pick it up, and then three sentences later you’re still reading the same sentence, your brain trying to figure out what it actually means. There’s none of that.

The book is roughly 570 pages long, which, given the fairly small font of the book, means a lot of content is packed in between the covers. The book is cut into roughly three sections.

The first is a reference of the language proper, covering topics like (for example) pointers, structures, and the preprocessor. There’s a high number of code samples (as would be expected in a book of this sort) to illustrate various concepts. There’s the occasional diagram for things like pointers.

The second part is a standard library reference. First is listed the contents of all the headers files. After that (sorted alphabetically) is a section on each function in the library, including a code sample and explanation of any relevant constants.

The third part (and for me one of the most valuable) is information on the GNU tools: GCC, Make and GDB. These are the core tools of writing a program in C on a UNIX platform, and rigorous coverage is given. I learned how to use both Make and GDB from this book. I’m not a Makefile god, but I can get by and fix a broken script, thanks to this book.

There’s a lot to like about this book. First is that it is complete. There’s nothing missing that could be desired. The second is that it is a lot easier to read than the proper C standard from the International Standards Organisation. Third is the up to date coverage: it covers C99 fully and points out what has changed since C89.

Finding things not to like about this book is difficult. One gripe though is the coverage of linked lists and binary trees. In my opinion, these either shouldn’t be put into a language reference book (since they aren’t part of the language), or cover them properly. A couple of pages with “here’s how do it” and then a code sample isn’t really adequate. A small point, but an annoying one nonetheless.

When buying a technical book, I always wonder whether it’s worth it. They are reasonably expensive*, and most of the content is usually available online for free. While this is true, these books (sometimes) offer more value than the online content. For a start, the C standard hasn’t changed now in 10 years. I also find that having a physical copy is handy, in that I don’t have to go fishing through a web browser in order to find what I want.

*expensive is relative. If I ate half as much lunch for a fortnight I could easily buy this book.

It’s not often that I pick up a book and love it to bits. The last time I read a page of a fiction book was over a month ago, and I last finished one back in 2007. Technical books are usually the same: read a few sections once, up onto the shelf never to be seen again. And I’m not saying this book is perfect, but it’s one book that I’m considering buying another copy of, simply because the old one is worn out. 5 stars.

If you want to buy a copy of the book, you can get it from Amazon.com here.

[ad#post-footer]

Tags: , , , ,

Leave a Reply