Feeds

Exceptional C++ and More Exceptional C++

Two essential aids for the C++ Interviewee

The Power of One eBook: Top reasons to choose HP BladeSystem

Book review This pair of books brings together a variety of small but annoying puzzles mediated by Herb Sutter through the news:comp.lang.c++.moderated newsgroup.

However, any irritation is in a good cause. Each puzzle illustrates an important point in C++ that many of us still get wrong. An early example is exception safe programming, which most of us (OK, yes, me), have struggled against. Fortunately for my self esteem, these puzzles are given a difficulty score of between 7 and 9 out of 10.

This gives a clue as to what these books really are, they’re not just textbooks. Instead, they map out 100 or so interview questions. Hence their awkward nature; the questions are supposed to be tricky. As a pimp who used to be a C++ contractor, I can say with some confidence that if you can get through these books, you will pass more than 80% of C++ interviews. However, these are not “…For Dummies” books, you are required to think hard and there is no real common theme beyond that of shattering any wishful thinking about your being a C++ guru.

Sutter is a Microsoft lackey, but fortunately, these aren’t Visual C++ books. Even though VC++ is vastly more standards conformant than it used to be, it is rarely mentioned except in connection with issues where the compiler gets to make choices.

Although inheritance is a common playground for interviewers, the coverage is sparse, probably reflecting Sutter’s accurate belief that as an O-O technique it is over used and, rightly, in relative decline as a programming technique.

Large scale design issues are skipped over lightly and, in general, these are books about programming in the small rather than the large. The exception to this is some waffle about header files in big projects and how to make them faster, which is rarely a critical issue in these days of precompilation and fast processors.

The second book emphasises STL and templates rather more and brings in threads. This is an area you really do need to start thinking about. Multi-core architectures mean that bog standard single thread code will execute 50%, or even 75%, more slowly than multi-threaded code on the same hardware; and that ratio is increasing. This is part of the optimisation theme, and although many books talk of writing “good” code, the hardcore stuff of making your code faster is usually rather skipped over in other books. Later in the book, Sutter points out some of the horrors that await the unwary over-optimiser [that’s good – Ed].

There is yet more on exception safety, which is clearly important enough for Sutter to bring his notion of programming “morality” to the topic. More Exceptional C++ also gives rather good coverage of the ancient dark art of pre-processor macros, a topic skipped over lightly in most other books. The sparse style is great for focusing on each issue, and for such short books, there's an impressive amount that you'll learn from them, although this comes at a price: if you don’t understand the example, you simply have to stare at it until it makes sense, because there is only ever one. You can of course argue that this is a good thing.

Exceptional C++ and More Exceptional C++

Verdict: If you’re going to go to a C++ interview any time in the next year, read these books and halve your chance of failure.

Author: Herb Sutter

Publisher: Addison Wesley

ISBNs: Exceptional C++ 0201615622; More Exceptional C++ 020170434

Media: Book

Buy Exceptional C++ at Cash & Carrion!

Buy More Exceptional C++ at Cash & Carrion too!

HP ProLiant Gen8: Integrated lifecycle automation

More from The Register

next story
Whoah! How many Google Play apps want to read your texts?
Google's app permissions far too lax – security firm survey
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Big Blue Apple: IBM to sell iPads, iPhones to enterprises
iOS/2 gear loaded with apps for big biz ... uh oh BlackBerry
prev story

Whitepapers

Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.