Q&A with "21st Century C" author Ben Klemens "C has no corporation or foundation pushing it, no trademarked logos, no ad budget, and no designers on perpetual book tour. It's just a simple, fast language." O'Reilly Media: What made you write the book? Ben Klemens: I kept having the same conversation, with the same disconnect. I would talk about how I was having an easy time writing code in C, and the person I was talking to would tell me that doing so is impossible, because everything needs to be written from scratch and there is endless declaration and memory management cruft obscuring the real flow of the code. Finally, I got a friend to concede that maybe I wasn't hallucinating, and maybe I really was writing C code in reasonable time and with reasonable clarity, and he asked me, "OK, so can you refer me to a textbook that teaches C with a modern style?" And finally, I understood the disconnect, because I couldn't find such a text. Everything I read was at least a decade old and had a section teaching you how to re-implement linked lists yet again. The C standard was revised in 1999, allowing for a much more flowing writing style, yet these books still presented code with a halting and obtuse style. ORM: Why is your book especially important now? BK: I should've written it five years ago. ORM: What is on the horizon for your readers? BK: I have it easy here, because C is still immensely common. You can find measures that say that it is the most popular computing language, and some that rank it at maybe No. 2 or No. 3. What makes this amazing about our 40-year-old friend is that it has no corporation or foundation pushing it, no trademarked logos, no ad budget, and no designers on perpetual book tour. It's just a simple, fast language. And it's not going away very quickly. I have no idea what we'll be writing 50 years from now, but I'm pretty confident that in five or 10 years, we'll still be writing a lot of C code. Also, C is still the lingua franca of computing. So many languages have a back door that lets you write some code in C, so even people who long ago decided to avoid C eventually find themselves writing little snippets in it. By the way, I'm obviously a satisfied user, but I come neither to praise or to bury C. The language has warts, many of which I point out in the book along the way to pointing out its better features. ORM: What is the single most important take-away from your book? BK: Use libraries. If you don't know how to link to a binary tree library, you are doomed to write your own binary tree implementation. I think a lot of the people who think everything in C has to be written from scratch have just never learned how to reliably link their code to the wealth of existing libraries. ORM: Who is your intended audience? BK: I have two. People who only know a smattering of C, which they picked up on the street. People who learned C from a more traditional textbook, and know that they need to update from how C was written in the 1980s. Probably included here are CS majors who were traumatized by their college C textbook and decided they hate C, that it is an unmerciful disaster, and so begins a downward spiral where they avoid writing in C, so when they do have some C-based problem it is a melancholy burden, so after getting that done they avoid writing any more C for as long as possible and thus their skills get rustier. This book can help to break the cycle.
Index Terms
- 21st Century C: C Tips from the New School
Recommendations
Personal computing in the 21st century
UIST '05: Proceedings of the 18th annual ACM symposium on User interface software and technologyEver since the dawn of the digital computer, invention, innovation, and creativity have been a hallmark of the industry. The mainframe computer seemed for a while to be the real player with experts or at least highly trained professionals operating ...