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):||10 February 2004|
|PDF File Size:||12.68 Mb|
|ePub File Size:||5.62 Mb|
|Price:||Free* [*Free Regsitration Required]|
Prefer function objects over functions as algorithm and comparer arguments. Use sufficiently portable types in a module’s interface. Avoid casting away const Prefer the canonical forms of arithmetic and assignment operators.
Design and write error-safe code. Ensure resources are owned by objects. Define standardz initialize member variables in the same order. Don’t use C-style casts.
It’s even better when what the coding standard requires is actually consistent, reasonable, and correct. Avoid calling virtual functions in qlexandrescu and destructors. Prefer compile- and link-time errors to run-time errors. Any and usually rare cases when a rule doesn’t apply.
Don’t use unions to reinterpret representation. Know when and how to code for scalability. Prefer the canonical form of assignment Don’t use unsafe functions. Throw by value, catch by reference.
If you provide any class-specific new, provide all of the standard forms plain, in-place, and nothrow Construction, Destruction, and Copying View table of contents. Define and initialize member variables in the same order Rely on types, not on representations.
Prefer providing abstract interfaces. Ensure resources are owned by objects.
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices
Prefer calling the prefix forms. Explicitly enable or disable copying Know what not to standardize. Public inheritance is substitutability.
Always write internal include guards. Prefer the canonical forms of arithmetic and assignment operators Prefer composition to inheritance. Make data members private, except in behaviorless aggregates C-stylestructs.
C++ Coding Standards – Book Home Page
Make base class destructors public and virtual, or protected and nonvirtual. Prefer minimal classes to monolithic classes.
Blend static and dynamic polymorphism judiciously Always provide new and delete together.