UKUUG home


(the UK's Unix & Open Systems User Group)






Book Discounts

Other Discounts

Mailing lists






C in a Nutshell: A Desktop Quick Reference

Peter Prinz and Tony Crawford
Published by O'Reilly Media
608 pages
£ 28.50
Published: January 6, 2006
reviewed by Graham Lee
   in the June 2006 issue (pdf), (html)

``C in a Nutshell'' caught my interest in a way that no other C reference I have read ever managed to achieve. A large part of its refreshing approach comes simply from the fact that this is a new book, not a revised edition of an existing work. This means that features of the language new with C99 are treated alongside the longer-standing features, rather than being relegated to sidebars or footnotes. For instance, the chapter on functions includes a section on the new inline keyword, and the new boolean and complex floating-point types are discussed in with the familiar int, char and friends. Such newer features are still marked out as such in the text, and this approach is useful as it reminds those familiar with older variants of C of the 1999-specific revisions, without giving newer readers the notion that such portions are somehow novel or side issues.

The heavy use of example code in ``C in a Nutshell'' complements the full treatment of the topics in the text. Where a complete discussion of pointer operations takes up three pages, a half-page example function demonstrates the commonly-used aspects more succinctly. The chapter on memory management is almost exclusively devoted to an implementation of a binary search tree, again to demonstrate `real-world' use of the matter under study. About a third of the book is given over to the chapter on standard library functions, and with most if not all modern Unix platforms distributing a comprehensive online manual, again the examples of using standard library functions are what make this section. It isn't going to break me out of my ingrained ``man foo'' habit, but for those times when the man page is just a little too terse this will be a great fallback. A quick word of warning though: in discussing math.h functions, the examples relate only to situations where the functions set errno on error. Consideration of floating-point exceptions is covered elsewhere in the book. This had me going for a good few hours as I tried to work out why the example didn't behave the same way on my system as theirs.

The final section (under 100pp) of the book covers the GNU tools gcc, make and gdb. I can't work out why this section should exist at all; not only are there better (and certainly more complete) discussions of the GNU toolchain available, but the style shifts from being a reference to an overview. A reader with a serious interest in using these tools for their C development would be better off with more specific references for them, such as the texinfo documentation or a different book.

The content is mercifully low on errors; it's all too common for books with large quantities of code fragments to contain gremlins, but in this case both the code and text are of high quality. The few mistakes I noticed didn't seriously affect the book's utility as a reference; for instance in the previously-mentioned binary search tree example, the text and the code disagree on whether equality is treated with the greater-than or less-than case in a condition. In practice it wouldn't matter which were used. As with much of the Nutshell series, this book is aimed at the competent programmer who needs a quick reference, not at the beginner. As a teacher of C programming, I had been looking for a reference work which covered the C99 version of the language standard, and did so in a readable format free of omissions and errors. ``C in a Nutshell'' did not disappoint, and the utility of the standard library reference was a welcome surprise.

Back to reviews list

Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
More information

Page last modified 02 Apr 2007
Copyright © 1995-2011 UKUUG Ltd.