Accelerated C++: Practical Programming by Example, Andrew Koenig and Rules, Guidelines, and Best Practices, Herb Sutter and Andrei Alexandrescu. Consistent, high-quality coding standards improve software quality, reduce time- to-market, promote teamwork, eliminate by Andrei Alexandrescu, Herb Sutter. Consistent, high-quality coding standards improve software quality, reduce time- to-market, promote teamwork, eliminate time wasted on inconsequential matters .
|Published (Last):||15 May 2017|
|PDF File Size:||5.91 Mb|
|ePub File Size:||9.63 Mb|
|Price:||Free* [*Free Regsitration Required]|
When should you provide a no-fail swap? Don’t use varargs ellipsis. Use vector by default. Throw by value, catch by reference Store only values and smart pointers in containers. Don’t define entities with linkage in a header file. Always provide new and delete together Whenever it makes sense, provide a no-fail swap and provide it correctly.
Consider making virtual functions nonpublic, and public functions nonvirtual. Ensure resources are owned by objects.
Don’t write unintentionally nongeneric code. Whenever it makes sense, provide a no-fail swap and provide it correctly Namespaces and Modules Preserve natural semantics for overloaded operators. Prefer compile- and link-time errors to run-time errors. Why and how should you prevent exceptions from propagating across andreii boundaries? Prefer compile- and link-time errors to run-time errors Prefer writing nonmember nonfriend functions. This book delivers a valuable set of tried-and-true rules, guidelines, and best practices condensed into concise one- and two-page Items.
Know when and how to code for scalability 8. Avoid allocating and deallocating memory in different modules Distinguish between errors and non-errors Series This product is part of the following series. Stter intentionally and explicitly.
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices
Use the right STL sort algorithm. Know when and how to code for concurrency. Prefer the canonical forms of arithmetic and assignment operators. Always provide new and delete together. With Safari, you learn the way you learn best.
Consider overloading to avoid implicit type conversions. This happens automatically when following a good, simple set syandards guidelines. Any and usually rare cases when a rule doesn’t apply.
Use the accepted idioms to really shrink capacity and really erase elements. Why shouldn’t you write namespace declarations or directives in a header file? Store only standdards and smart pointers in containers. Destructors, deallocation, and swap never fail. Examples that demonstrate a rule or make it memorable. Consider overloading to avoid implicit type conversions Use a version control system 4. Construction, Destruction, and Copying. Give one entity one alxeandrescu responsibility 6.
Avoid providing implicit conversions. Use a checked STL implementation Know what not to standardize. Use explicit RAII and smart pointers. If you’re interested in creating a cost-saving package for your students, contact your Pearson rep.
Establish a rational error handling policy, and follow it strictly Prefer compile- and link-time errors to run-time errors. Avoid initialization dependencies across compilation units.
Assert liberally to document internal assumptions and invariants.
Take parameters appropriately by value, smart pointer, or reference Avoid inheriting from classes that were not designed to be base classes. Make header files self-sufficient. Use a version control system. Blend static and dynamic polymorphism judiciously. Don’t allow exceptions to propagate across module boundaries. Preserve natural semantics for overloaded operators.
What are the best ways to code for scalability?