Edinburgh Castle
C in a Nutshell
AuthorsPeter Prinz & Tony Crawford
PublisherO'Reilly
ISBN0-596-00697-7
DateDecember 2005
Pages600
Price£28.50
ReviewerRory Macdonald
Cover image for C in a Nutshell

Part I deals with the C programming language. Technically I found the authors' writing to be well measured, striking a good balance between succinctness and depth. This was accomplished while avoiding dryness in what was a sensibly structured text.

However on page 136 in the section on "Pointers to Functions", I came across something which tainted the rest of the book for me. The example code used (example 9.5) bore a striking resemblance to example code used in a well-known online treatment of the same topic, by Lars Haendel. Search for "C function pointer" if you don't already know the name.

I found the legalese at the front of the book regarding use of code examples and the requirement for the work to be attributed to the authors, with copyright assigned to O'Reilly. I also found the author's acknowledgements and thanks sections, with no mention of Haendel.

Now, it may well be that the authors came up with their code example for "Pointers to Functions" on their own and that it is just sheer coincidence that they chose to use the exact same set of fuctions to illustrate callbacks - or it may be that they determined that they did not have to acknowledge Haendel, for whatever reason.

However, given that the copyright of Haendel's example predates the book under review, it seems likely to me that the authors' example was at least inspired by Haendel's text. And so, from then onwards, I continually wondered just how much of these code examples, copyright of O'Reilly, were inspired by or taken from some unacknowledged source.

The authors didn't write the C programming language, so they're already standing on the shoulders of giants. But I would expect any author writing about a programming language they didn't create to sing good and hard for their supper and at the very least put the effort into developing their own code examples.

Leaving that hiccup aside, part II is a good reference for the standard library, clearly marking those functions added in C99 while offering many small examples of usage throughout. Following two short chapters outlining the header files and functions grouped by areas of application, the beefier library reference is offered up in alphabetic order, with about 2 functions being fitted in per page.

Accounting for over 40% of the page count, this part felt like the real meat and two veg' of the book and I expect this section will receive the most regular thumbing by owners.

I would have been happy to see the credits roll at this point. However, the authors had bolted on 3 chapters dealing with some big hitters from the GNU tools stable; gcc, make and gdb.

My first reaction was that this was surplus to requirement and was less than impressed to see early gcc content explaining how to obtain gcc, followed by a step-by-step handholding of how C code becomes an executable. Similar baby steps were taken in the gdb chapter when the authors felt the need to define for the reader what a debugger is.

The authors state their goal for the book to be "a convenient, reliable companion for C programmers in their day-to-day work.". They also state that the text is "not an introduction to programming in C".

I found the (albeit) short treament of fundamentals in the gcc and gdb content hard to reconcile with the above statements. However, I saw these three chapters as reasonable introductory fodder for those who may be new to the language or to GNU tools.

Those either using different tool chains, or with experience in the covered tools, are unlikely to do more than fan past these pages on the way to the index. For that reason I can't help but think that these pages are either already a waste, or shortly will be as the reader outgrows the relatively potted coverage afforded.

Summary

Maybe I've grown sentimentally attached to my K&R, but as good as the writing is, there was little in part I to make me consider retiring the older, original work.

As for part III, did it add value? I don't believe it did and I can't stand dead weight in dead wood. "No wasted words here!" the back cover boasts. I disagree.

The authors want this to be "..the book every C programmer will want nearby when writing code". Did it deliver? I'd have to say, 'maybe'. Let me qualify that.

First off, I don't believe anyone is going to be swayed into buying this book for the three GNU tools chapters. So it all boils down to what you already have for language and standard library reference.

Got K&R? Happy with standards docs or some other C99-grade standard C library reference? Then I don't see this being worth your money.

However, if you already have K&R, and you don't already have a decent C99-grade standard C library reference, then I'd say part II is probably worth the price of admission.

And, finally, if you don't already have any C language/library reference text while going about your "day-to-day work", then this book is a great place to start.

Table of contents

C in a Nutshell
Part I Language
Ch  1. Language Basics
Ch  2. Types
Ch  3. Literals
Ch  4. Type Conversions
Ch  5. Expressions and Operators
Ch  6. Statements
Ch  7. Functions
Ch  8. Arrays
Ch  9. Pointers
Ch 10. Structures, Unions and Bit-Fields
Ch 11. Declarations
Ch 12. Dynamic Memory Management
Ch 13. Input and Output
Ch 14. Processing Directives

Part II Standard Library
Ch 15. The Standard Headers
Ch 16. Functions at a Glance
Ch 17. Standard Library Functions

Part III Basic Tools
Ch 18. Compiling with GCC
Ch 19. Using make to Build C Programs
Ch 20. Debugging C Programs with GDB

Index


    
faded separator

Page maintained via github.com/edinburgh-pm/edinburgh.pm