47 Engineering Puzzles, Programming Problems, and Solutions
Author: Herb Sutter
Publisher: Addison-Wesley Professional
The puzzles and problems in Exceptional C++ not only entertain, they will help you hone your skills to become the sharpest C++ programmer you can be. Many of these problems are culled from the famous Guru of the Week feature of the Internet newsgroup comp.lang.c++, moderated, expanded and updated to conform to the official ISO/ANSI C++ Standard. Try your skills against the C++ masters and come away with the insight and experience to create more efficient, effective, robust, and portable C++ code.
55 Specific Ways to Improve Your Programs and Designs
Author: Scott Meyers
Publisher: Pearson Education
“Every C++ professional needs a copy of Effective C++. It is an absolute must-read for anyone thinking of doing serious C++ development. If you’ve never read Effective C++ and you think you know everything about C++, think again.” — Steve Schirripa, Software Engineer, Google “C++ and the C++ community have grown up in the last fifteen years, and the third edition of Effective C++ reflects this. The clear and precise style of the book is evidence of Scott’s deep insight and distinctive ability to impart knowledge.” — Gerhard Kreuzer, Research and Development Engineer, Siemens AG The first two editions of Effective C++ were embraced by hundreds of thousands of programmers worldwide. The reason is clear: Scott Meyers’ practical approach to C++ describes the rules of thumb used by the experts — the things they almost always do or almost always avoid doing — to produce clear, correct, efficient code. The book is organized around 55 specific guidelines, each of which describes a way to write better C++. Each is backed by concrete examples. For this third edition, more than half the content is new, including added chapters on managing resources and using templates. Topics from the second edition have been extensively revised to reflect modern design considerations, including exceptions, design patterns, and multithreading. Important features of Effective C++ include: Expert guidance on the design of effective classes, functions, templates, and inheritance hierarchies. Applications of new “TR1” standard library functionality, along with comparisons to existing standard library components. Insights into differences between C++ and other languages (e.g., Java, C#, C) that help developers from those languages assimilate “the C++ way” of doing things.
Scott Meyers’s seminal C++ books– Effective C++ , More Effective C++ , and Effective STL –have been immensely helpful to hundreds of thousands of C++ programmers. All three are finally available together in this eBook collection. Effective C++ has been embraced by hundreds of thousands of programmers worldwide. The reason is clear: Scott Meyers’s practical approach to C++ describes the rules of thumb used by the experts to produce clear, correct, efficient code. The book is organized around 55 specific guidelines, each of which describes a way to write better C++. Each is backed by concrete examples. In More Effective C++, Meyers presents 35 ways to improve your programs and designs. Drawing on years of experience, Meyers explains how to write software that is more effective: more efficient, more robust, more consistent, more portable, and more reusable. In short, how to write C++ software that’s just plain better. In Effective STL, Meyers goes beyond describing what's in the STL to show you how to use it. Each of the book’s 50 guidelines is backed by Meyers’s legendary analysis and incisive examples, so you’ll learn not only what to do, but also when to do it–and why. Together in this collection, these books include the following important features: Expert guidance on the design of effective classes, functions, templates, and inheritance hierarchies. Applications of new “TR1” standard library functionality, along with comparisons to existing standard library components. Insights into differences between C++ and other languages (e.g., Java, C#, C) that help developers from those languages assimilate “the C++ way” of doing things. Proven methods for improving program efficiency, including incisive examinations of the time/space costs of C++ language features Comprehensive descriptions of advanced techniques used by C++ experts, including placement new, virtual constructors, smart pointers, reference counting, proxy classes, and double-dispatching Examples of the profound impact of exception handling on the structure and behavior of C++ classes and functions Practical treatments of new language features, including bool, mutable, explicit, namespaces, member templates, the Standard Template Library, and more. If your compilers don’t yet support these features, Meyers shows you how to get the job done without them. Advice on choosing among standard STL containers (like vector and list), nonstandard STL containers (like hash_set and hash_map), and non-STL containers (like bitset). Techniques to maximize the efficiency of the STL and the programs that use it. Insights into the behavior of iterators, function objects, and allocators, including things you should not do. Guidance for the proper use of algorithms and member functions whose names are the same (e.g., find), but whose actions differ in subtle (but important) ways. Discussions of potential portability problems, including straightforward ways to avoid them.
40 New Engineering Puzzles, Programming Problems, and Solutions
Author: Herb Sutter
Publisher: Addison-Wesley Professional
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.
Consistent, high-quality coding standards improve software quality, reduce time-to-market, promote teamwork, eliminate time wasted on inconsequential matters, and simplify maintenance. Now, two of the world's most respected C++ experts distill the rich collective experience of the global C++ community into a set of coding standards that every developer and development team can understand and use as a basis for their own coding standards. The authors cover virtually every facet of C++ programming: design and coding style, functions, operators, class design, inheritance, construction/destruction, copying, assignment, namespaces, modules, templates, genericity, exceptions, STL containers and algorithms, and more. Each standard is described concisely, with practical examples. From type definition to error handling, this book presents C++ best practices, including some that have only recently been identified and standardized-techniques you may not know even if you've used C++ for years. Along the way, you'll find answers to questions like What's worth standardizing--and what isn't? What are the best ways to code for scalability? What are the elements of a rational error handling policy? How (and why) do you avoid unnecessary initialization, cyclic, and definitional dependencies? When (and how) should you use static and dynamic polymorphism together? How do you practice "safe" overriding? When should you provide a no-fail swap? Why and how should you prevent exceptions from propagating across module boundaries? Why shouldn't you write namespace declarations or directives in a header file? Why should you use STL vector and string instead of arrays? How do you choose the right STL search or sort algorithm? What rules should you follow to ensure type-safe code? Whether you're working alone or with others, C++ Coding Standards will help you write cleaner code--and write it faster, with fewer hassles and less frustration.