+612 9045 4394
Exceptional C++ Style : 40 New Engineering Puzzles, Programming Problems, and Solutions - Herb Sutter

Exceptional C++ Style

40 New Engineering Puzzles, Programming Problems, and Solutions

Paperback Published: 1st August 2004
ISBN: 9780201760422
Number Of Pages: 352

Share This Book:


RRP $128.99
or 4 easy payments of $24.84 with Learn more
Ships in 7 to 10 business days

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.

Prefacep. ix
Generic Programming and the C++ Standard Libraryp. 1
Uses and Abuses of vector
The String Formatters of Manor Farm, Part 1: sprintfp. 10
The String Formatters of Manor Farm, Part 2: Standard (or Blindingly Elegant) Alternativesp. 16
Standard Library Member Functionsp. 27
Flavors of Genericity, Part 1: Covering the Basis [sic]p. 31
Flavors of Genericity, Part 2: Generic Enough?p. 35
Why Not Specialize Function Templates?p. 42
Befriending Templatesp. 49
Export Restrictions, Part 1: Fundamentalsp. 59
Export Restrictions, Part 2: Interactions, Usability Issues, and Guidelinesp. 68
Exception Safety Issues and Techniquesp. 79
Try and Catch Mep. 80
Exception Safety: Is It Worth It?p. 85
A Pragmatic Look at Exception Specificationsp. 89
Class Design, Inheritance, and Polymorphismp. 99
Order, Order!p. 10
Uses and Abuses of Access Rightsp. 104
(Mostly) Privatep. 110
Encapsulationp. 119
Virtualityp. 129
Enforcing Rules for Derived Classesp. 139
Memory and Resource Managementp. 151
Containers in Memory, Part 1: Levels of Memory Managementp. 152
Containers in Memory, Part 2: How Big Is It Really?p. 156
To new, Perchance to throw, Part 1: The Many Faces of newp. 164
To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Managementp. 173
Optimization and Efficiencyp. 183
Constant Optimization?p. 184
inline Reduxp. 190
Data Formats and Efficiency, Part 1: When Compression Is the Name of the Gamep. 199
Data Formats and Efficiency, Part 2: (Even Less) Bit-Twiddlingp. 204
Traps, Pitfalls, and Puzzlersp. 213
Keywords That Aren't (or, Comments by Another Name)p. 214
Is It Initialization?p. 221
double or Nothingp. 227
Amok Codep. 230
Slight Typos? Graphic Language and Other Curiositiesp. 235
Operators, Operators Everywherep. 239
Style Case Studiesp. 245
Index Tablesp. 246
Generic Callbacksp. 258
Construction Unionsp. 267
Monoliths "Unstrung," Part 1: A Look at std::stringp. 286
Monoliths "Unstrung," Part 2: Refactoring std::stringp. 292
Monoliths "Unstrung," Part 3: std::string Diminishingp. 301
Monoliths "Unstrung," Part 4: std::string Reduxp. 305
Bibliographyp. 315
Indexp. 319
Table of Contents provided by Ingram. All Rights Reserved.

ISBN: 9780201760422
ISBN-10: 0201760428
Series: C++ In Depth SERIES
Audience: Tertiary; University or College
Format: Paperback
Language: English
Number Of Pages: 352
Published: 1st August 2004
Publisher: Pearson Education (US)
Country of Publication: US
Dimensions (cm): 22.9 x 18.8  x 1.8
Weight (kg): 0.55