REVIEW - 21st Century C - C Tips from the New School

Title:

21st Century C - C Tips from the New School

Author:

Ben Klemens

ISBN:

9781449327149

Publisher:

O'Reilly (2012)

Pages:

273pp

Reviewer:

Alexander Demin

Reviewed:

October 2016

Rating:

★★★★★

Reviewed: January 2013

This is the first sentence from the preface: ‘C has only a handful of keywords and is a bit rough around the edges, and it rocks. You can do anything with it. Like the C, G and D chords of a guitar, you can learn the basic mechanics pretty quickly, and then spend the rest of your life getting better.’

Frankly, I had been hooked by this book from the start because I personally share exactly the same feeling about C. So, I continued reading, and here is my, of course, biased and subjective review.

As follows from the title, this book is about the latest cutting edge C, but it is not a textbook. Instead, the author explains some details of modern C, which many people still do not use sticking instead with ‘classic’ approaches, and also covers best practices for productive working with C.

First, the author briefly covers the situation with standards (C89, C99 and C11) and major implementations (gcc, clang). He steps through programming environments of modern C, debugging and documenting, version control, and packaging. Then he comes to the language itself. There is a chapter called ‘C syntax you can ignore’, which I read first. The rest of the book is dedicated the best practices: use of structures and pointers, text (mostly about Unicode), object-oriented approaches in C and a few mainstream libraries.

It may look like the material is a bit chaotic, but, again, this is not a textbook. The material definitely helps with rethinking your current use of C applying all new fancy bells and whistles.

Finally, a couple of my personal findings. For example, I had not heard at all about the restrict keyword and the asprintf()function. I liked a lot that the author promotes makefiles instead of piling up zillions of scripts, plus the advice of using private_ prefix in structure field names (simple and harmless but practical).

Any book can become tedious if you agree with everything. But I found that some topics like ‘a good use of goto’, autotools and doxygen generate a lot of arguments in me. Such ‘holy war’ subjects make the book even better because you will have more topics for a chat with your colleagues on the kitchen.


Book cover image courtesy of Open Library.