FREE Delivery in the UK.
Only 1 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
Exceptional C++ Style: 40... has been added to your Basket
Trade in your item
Get a £11.00
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 3 images

Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems and Solutions (C++ in Depth) Paperback – 2 Aug 2004

2 customer reviews

See all 2 formats and editions Hide other formats and editions
Amazon Price New from Used from
"Please retry"
£22.43 £36.27
Unknown Binding
"Please retry"
£30.99 FREE Delivery in the UK. Only 1 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.

Special Offers and Product Promotions

  • Win a £5,000 Amazon.co.uk Gift Card for your child's school by voting for their favourite book. Learn more.
  • Prepare for the summer with our pick of the best selection for children (ages 0 - 12) across Amazon.co.uk.

Frequently Bought Together

Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems and Solutions (C++ in Depth) + More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions: 40 More Engineering Puzzles, Programming Problems, and Solutions (AW C++ in Depth) + C++ Coding Standards : Rules, Guidelines, and Best Practices
Price For All Three: £83.82

Buy the selected items together

Win a £5,000 Amazon.co.uk Gift Card and 30 Kindle E-readers for your child or pupil's school.
Vote for your child or pupil(s) favourite book(s) here to be in with a chance to win.

Product details

  • Paperback: 352 pages
  • Publisher: Addison Wesley; 1 edition (2 Aug. 2004)
  • Language: English
  • ISBN-10: 0201760428
  • ISBN-13: 978-0201760422
  • Product Dimensions: 18.7 x 1.8 x 23.2 cm
  • Average Customer Review: 4.5 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 720,963 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

Software "style" is about finding the perfect balance between overhead and functionality... elegance and maintainability... flexibility and excess. In Exceptional C++ Style, legendary C++ guru Herb Sutter presents 40 new programming scenarios designed to analyze not only the what but the why and help you find just the right balance in your software.

Organized around practical problems and solutions, this book offers new insight into crucial C++ details and interrelationships, and new strategies for today's key C++ programming techniques--including generic programming, STL, exception safety, and more. You'll find answers to questions like:

  • What can you learn about library design from the STL itself?
  • How do you avoid making templated code needlessly non-generic?
  • Why shouldn't you specialize function templates? What should you do instead?
  • How does exception safety go beyond try and catch statements?
  • Should you use exception specifications, or not?
  • When and how should you "leak" the private parts of a class?
  • How do you make classes safer for versioning?
  • What's the real memory cost of using standard containers?
  • How can using const really optimize your code?
  • How does writing inline affect performance?
  • When does code that looks wrong actually compile and run perfectly, and why should you care?
  • What's wrong with the design of std::string?

Exceptional C++ Style will help you design, architect, and code with style--and achieve greater robustness and performance in all your C++ software.

About the Author

Herb Sutter is the author of three highly acclaimed books, Exceptional C++ Style, Exceptional C++, and More Exceptional C++ (Addison-Wesley). He chairs the ISO C++ standards committee, and is contributing editor and columnist for C/C++ Users Journal. As a software architect for Microsoft, Sutter leads the design of C++ language extensions for .NET programming.

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4.5 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

7 of 7 people found the following review helpful By Thing with a hook on 21 Feb. 2007
Format: Paperback
I had mixed feelings on this one. On the one hand, this is definitely a good book. You won't find a lot of the material here having filtered out to any other book yet. On the other hand, the actual content itself feels more ephemeral than the previous two installments. Personally, I don't have a problem with that; Sutter's work can be read perfectly well as a way to pick up the general principles of solid C++ engineering from an articulate, reliable expert, you don't need him to be spelling out everyday techniques to get something useful from his writing.

As an example, the items that I found most memorable included his investigation of how compilers failed to adhere to the standard when it comes to template friend function look up, with the surprising result that the normally reliable g++ is the worst offender. Additionally, he demonstrates several ways to call private member functions from outside of a class. I'm certain that fans of the last two books will get a kick out of this stuff, but it's not quite at the same level as his work designing for exception safety.

In addition to the usual question-essay-guideline format, the book has a substantial final section dissecting some failings of publicly-available code, which is where I assume the title of the book comes from. Those with fond memories of Tom Cargill's C++ Programming Style will definitely like this bit.

Despite the fact that the material is arguably slightly thinner than usual, the number of pages is actually up on the previous books. Sutter's writing style has also expanded. However, in a couple of places, the writing could have done with some editing. There are some witty asides and extraneous material that take up just a bit too much space.

Nonetheless, Sutter-nutters will probably not be too disappointed by Exceptional C++ Style. I still really enjoyed this book; reading it was time well spent.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
By fleure sauvage on 26 July 2014
Format: Paperback Verified Purchase
excellent book
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 11 reviews
19 of 19 people found the following review helpful
Excellent for C++ programmers at all levels 13 Aug. 2004
By Michi - Published on Amazon.com
Format: Paperback
This book is not so much about C++ "style" in the usual sense (that is, how to indent or where to put the curly braces) but rather, about sound coding practices that make your code simpler, better, faster, and more maintainable. What you get is a collection of 40 items that each examine a specific topic, outline the potential problems with a particular approach, and then proceed to show you how things can be improved. Most importantly, each item is strong on the rationale: you are not just told how to do it better, but *why* it is is better to do something in a particular way.

There is something for everyone in this book, from the obscure and astonishing ("How many consecutive '+' characters can appear in a standards-conforming program?"), to the pragmatic ("When should you use inlining?"), to the advanced ("How generic should you make your templates, and why?").

I've been programming in C++ for 16 years now, and I learned quite a lot from reading this book. Yet, you don't have to be a C++ veteran to appreciate the advice that is provided: novice C++ programmers will find the items just as useful as old hands at C++ programming.

The book is well written, in clear and concise style, and never boring. (A number of creative footnotes even produce the occasional laugh.) The material is well organized, presented in groups of topics that relate to each other, and the table of contents and index make it easy to locate a topic for reference. And the bibliography contains things that are actually worth reading, rather than meaningless filler material.

I most appreciated Herb's honesty when dealing with various not-so-great aspects of C++. He doesn't shy back from pointing out when things are bad and simply shouldn't be used (such as exception specifications). The items I enjoyed the most are about the design of std::string, which Herb dissects (or should I say "trashes"?) unmercifully. To me, the book is worth buying just for these items alone because they provide splendid insight into what distinguishes good design from bad design, and how methodical and clear thinking is essential to writing good programs. ("Beware the behemoth of the Winnebago class -- it will haunt you onto the fourth generation...")

In summary, I think every C++ programmer should read this book. Yes, it's *that* good.
27 of 29 people found the following review helpful
Simply exceptional 5 Aug. 2004
By Amazon Customer - Published on Amazon.com
Format: Paperback
Did you know the "snprinf(...)" that we use in our programs is not part of the C++ standard? Did you know that the "export" keyword has little or no benefit to C++ templates and the source code of the implementation still needs to be shipped? Do you know what primary templates are? Did you know that Accessibility checking is the last things a compiler checks for - after checking for overload resolution? Do you make your virtual functions private? Well, you really should. Do you know what Herb Sutter's favorite Starbucks drink is? Do you know what the "const" keyword really buys you? How about inline-ing?

If you answered no to even one of these questions, you should read Herb Sutter's Exceptional C++ Style, 40 New Engineering Puzzles, Programming Problems, and Solutions book. I must say that I am not doing justice in reviewing this book, since each item in this 40 item collection should really reviewed independently as each one is very well written, useful and practical.

To start, this book is well organized into sections as one would expect such type of organization with book of such type. One differing aspect is with the Case Studies at the end of the book. Mostly around the string class, but nonetheless, they are very informative. The author has taken already-out-there-being-used code and depicts them for their style. Various "guidelines" given by the author in the Case Studies section makes the developer's life a whole lot simpler. One of my favorite guidelines - throughout the book - is the one the author gives about the decision that each developer goes thru when designing a class and wants to make a decision about what to make friend, a member and a non-member of a class:

- Always make it a member if it has to be one.

- Prefer to make it a member if it needs access to internals

- In all other cases, prefer to make it a non-member friend.

Simple? Well, it should be. There are plenty of explanation and example for each of the given guidelines. As one reads and understands the given guidelines, they are very easy memorize-able. Three small phrases which we call have used or even know when we write code, but they are all on paper and are made very simple to be carved in one's memory. The author makes a great deal of effort to follow this routine, an engineering approach to solving problems and designing software, throughout the book. This book is like having an engineering notebook with fun-facts and pointers and hints that you always wanted to know and now you do!

I should really have gone thru the book in some sort of a chronological order, but I figured that the Case Studies are rather unique in this book and require special attention.

Who would have thought that there is so much to the Standard Template Libraries? Did you know that there are functions/methods in the STL that one can not even use with the STL? (Item 4) "...the bottom line is that you can't reliably form pointers to standard library member functions and still have portable code." I was blown away by this bold statement. What do you mean? You want to tell me that standard doesn't really constitute a standard? Want to tell me that my code that I have been so carefully writing using the STL might not be portable after all? There are rather amazing twists in the C++ language, and the author elegantly describes these abnormalities, and it the process the author manages to blow your mind away.

A great amount of attention is given throughout the book to the "boost" libraries. I was not familiar with "boost", and I was interested enough after reading this book that I will make a point to read up on it. The author does make a claim that the boost library might become part of the C++ standard, which would explain why the author has referred to the boost library so much in his text. A good deal of attention was also given to Inheritance and Polymorphism as one would expect. You see this topic all the time in every C++ book, but there are still grounds uncovered and stones unturned. You can't ever have enough of this specific topic. The most intriguing part is Item 16 about a class's Private Parts! If you think that Private members are really hidden, then think again and read Item 16 - you will be amazed at how the C++ compiler treats private members and methods.

Virtuality and virtual classes: you know them as the cause of needing to stay at work late to debug your code, and the reason behind male pattern baldness due to the stress that they cause you. If this is the least bit true, then Item 18 is for you. The best quote out of this item is made when the author talks about public virtual functions: "Prefer to make virtual functions private." Why you ask? Read Item 18 and find out.

A wealth of information is in this book. Herb Sutter has done it again. This book is a must for every C++ programmer as it further unleashes the great power and flexibility of the C++ programming language.
10 of 10 people found the following review helpful
Yet More Exceptional C++ 11 Nov. 2004
By Paul M. Dubuc - Published on Amazon.com
Format: Paperback
This book is a great addition to Herb Sutter's previous two "Exceptional" C++ books. It follows a very similar question and answer format that helps the reader think about a problem before being given the answer and so is more effective in helping you learn than are some other books. It gives very clear and concise answers to each problem with guidelines drawn from each lesson highlighted throughout the text that help you remember the main points.

The only problem now that I have is, with all three of these books on my shelf, it takes longer to figure out where I read something of on a particular topic. The topical sections of each book overlap (E.g., sections covering exception eafety, memory managment and inheritance appear in all three books.) and they are all written at the same level of difficulty overall. The later books do make plenty of references back to the earlier ones as well as some other very good C++ books but this material would be better organized in one volume rather than three. Perhaps they should have been published as three editions of the same book rather than three separate books. That's the only thing I can think of that would have made them more useful. Even so this book, like the other two, is very good exercise for keeping C++ programming skills sharp. Well done!
6 of 6 people found the following review helpful
Good read for both bit-heads and architects 12 Oct. 2004
By Jack D. Herrington - Published on Amazon.com
Format: Paperback
This is a very interesting read. There is lots of information for bit-twiddlers who like pushing the limits of the language syntax and templates. But there is also lots of high level information which is on the application architecture and good advice level. He is a big proponent of encapsulation over inheritance, which is something that I also advocate having been in a number of deeply and twisty code bases.

There are some sections that I found a little too technical, but that is a personal issue. Though it is nice to have my brain stretched now and again. Illustrations are kept to a minimum. The text is somewhat dry, but it's still a solid read.

I recommend this book for any advanced C++ programmer. It's well worth your time and money. It's not so clear to me that an intermediate programmer would get much out of it, and I think beginners should stick to something like Bruce Eckel's Thinking in C++.
21 of 27 people found the following review helpful
Too little information 13 Dec. 2004
By Konstantin Kivi - Published on Amazon.com
Format: Paperback
I am rather disappointed by this book, especially after

Exceptional and More Exceptional C++ which are wonderfull.

Yes, this book contain interesting information, especially about

some "dark corners" of C++. But I have the impression that the author

tried to "fill space" to make the required volume. For example in discussing

virtual/non virtual destructors he writes:

"If I had a penny for every time I've seen this debate, I could buy

a cup of coffee" Ok, we get the idea.

but he continues: "Not just any old coffe, mind you- I could buy a

genuine Starbucks Venti Extra Toffe Nut Latte ( my current favorite). Maybe

even two of them, if I was willing to throw in a dime of my own".

In the other place he devoted more than a page to explain the conventional

meaning of word "encapsulation" consulting several dictionaires.

Without this the book would be half of the current size
Were these reviews helpful? Let us know