Channels ▼

Developer Reading List

, December 21, 2012 New books on C, C#, Node, Win8 Apps, Perl and Groovy.
  • E-mail
  • Print

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.






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.