O’Reilly news

C++ Cookbook: C++ Recipes Spell Freedom from Mundane Tasks

November 29, 2005

Sebastopol, CA--C++ has earned a reputation for being one of the more difficult languages to learn. Those who master it, however, are not just gluttons for punishment, but are able to organize and process information with amazing efficiency and quickness. Powerful, highly flexible, and adaptable for use in a wide variety of projects, C++ doggedly maintains its position as one of the most popular programming languages in the world. As is the case with many languages, there exists an abundance of good C++ reference books and tutorials for programmers to draw upon, but far too few resources for the programmer who wants expert advice on how to accomplish common programming tasks in an effective and proven manner. The C++ Cookbook (O'Reilly, US $44.95) by D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, and Jeff Cogswell, fills this void nicely. The book presents a wealth of solutions to everyday C++ programming problems.

Coauthor Chris Diggins observes that the C++ Cookbook is long overdue, adding, "The C++ book market primarily consists of either 'gotcha' or 'reference' books. As a professional developer, I usually don't want to know ten different ways of doing things, or ten different ways not to do something. I want to know the most effective way to accomplish a specific task as fast as possible. This is something I feel that the C++ Cookbook does well, and is one of the first books to even attempt to address a wide variety of common programming tasks. This is why I was so excited to participate in its development."

Most C++ programmers, whether experienced or newly initiated, are familiar with the sorts of things they have to rewrite on each new project: date and time parsing/arithmetic, string and text, working with files, parsing XML, using the standard containers, and so on. These are the kinds of problems the C++ Cookbook covers. In some cases--such as data and time arithmetic--the standard library contains very little support. In others--e.g. string manipulation--the standard library contains functionally rich classes, but it can't do everything and some very common tasks are cumbersome.

In the C++ Cookbook, the authors provide solutions that reflect current best practices in C++ programming. They focus on performance and portability, with a strong emphasis on formal and ad hoc standards. "One of C++'s strengths is that there are many ways to do the same thing, but this can muddy the waters for novices," notes coauthor Stephens. "We wrote this book to provide ready-made solutions to common problems using the best practices so readers can look up a problem, read the solution, tailor it to his or her needs, and take away some useful wisdom." Many of the solutions take advantage of the C++ standard library. The authors also cover the Boost libraries, which represent some of the best thinking in the world of C++.

In creating their code examples, the authors strove for simplicity, portability, and performance. Topics covered in the book include: working with numbers, dates and times, stream-based input/output, exception handling, building applications with make, multithreading, standard library algorithms and containers, internationalization, and the Boost build system.

The C++ Cookbook is written in a straightforward format, featuring recipes that apply not to hypothetical situations, but to those that programmers are likely to encounter. A detailed explanation then follows each recipe in order to show readers how and why the solution works. This question-solution-discussion format is a proven teaching method, freeing programmers from mundane, time-consuming problems so they can turn their talents to more interesting work.

Additional Resources:

C++ Cookbook
D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, and Jeff Cogswell
ISBN: 0-596-00761-2, 573 pages, $44.95 US
order@oreilly.com
1-800-998-9938; 1-707-827-7000

About O’Reilly

O’Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O’Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying “faint signals” from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.

Email a link to this press release