Developer Reading List
, December 21, 2012 New books on C, C#, Node, Win8 Apps, Perl and Groovy.
21st Century C (C Tips from the New School)
by Ben Klemens
I love C, I really do. But like many C developers, I do tire of the manual, low-level work that has no way to rise to higher levels unless I embed a scripting engine, such as Lua or Tcl. So, this book looked to me like a breath of fresh air that might bring a new perspective. Written in a smart-alecky style, it promises to present the new school (whatever that is) for writing C. Alas, the promise was far greater than the delivery. There are several problems that become salient immediately: While the introductory chapter mentions Microsoft tools, the text is exclusively about gcc and GNU libraries. The proposed solution for Visual C++ devs is to abandon their environment and migrate with Cygwin or its clones. (Other Windows C compilers are ignored entirely, as is the LLVM.) The build process proposed uses autotools, the debugger is GDB, and the SCM tool is Git (which, oddly, is given an entire chapter).
The discussion of C per se is centered around a handful propositions that, we're told, characterize the new C. These include: reduce your use of malloc
, reduce your use of printf
, use typedef
more, and rely on libraries where you can. Getting rid of printf()
is done here by using asprintf()
, which is found in BSD or gcc ecosystems only. I'll save you the explanation of malloc
replacement, which is mostly unconvincing Where the book does shine is in introducing useful facilities delivered in the C11 standard. The author does a good job of showing where these can help. However, they are scattered throughout the book, so you have to pick through the chaff to get to the grain.
If the author had stopped there, we'd be more or less OK, but he decides to enter into a lengthy discussion on how to do OOP in C. After so many have failed on this mission before him, it's disappointing to see another attempt to transform the language into something it was never meant to be. The resulting mish-mash of code based in part on Glib and code-substitution tools will not endear itself to many readers, I'm afraid. The book can be recommended only for its coverage of C11, but I expect that forthcoming books will do a better job of that.