作者:Herb Sutter / Andrei Alexandrescu
副书名:101 Rules, Guidelines, and Best Practices (C++ In-Depth Series)
出版日期:2004-10-25
出版社:Addison Wesley
页数:220
文件格式:PDF
Consistent, high-quality coding standards improve software quality,reduce time-to-market, promote teamwork, eliminate time wasted oninconsequential matters, and simplify maintenance. Now, two of theworld’s most respected C++ experts distill the rich collectiveexperience of the global C++ community into a set of coding standardsthat every developer and development team can understand and use as abasis for their own standards.
The authors cover virtually every facet of C++ programming: designand coding style, functions, operators, class design, inheritance,construction/destruction, copying, assignment, namespaces, modules,templates, genericity, exceptions, STL containers and algorithms, andmore. Each standard is described concisely, with practical examples.From type definition to error handling, this book presents C++ bestpractices, including some that have only recently been identified andstandardized–techniques you may not know even if you’ve used C++ foryears. Along the way, you’ll find answers to questions like
What’s worth standardizing–and what isn’t? What are the best ways tocode for scalability? What are the elements of a rational errorhandling policy? How (and why) do you avoid unnecessary initialization,cyclic, and definitional dependencies? When (and how) should you usestatic and dynamic polymorphism together? How do you practice “safe”overriding? When should you provide a no-fail swap? Why and how shouldyou prevent exceptions from propagating across module boundaries? Whyshouldn’t you write namespace declarations or directives in a headerfile? Why should you use STL vector and string instead of arrays? Howdo you choose the right STL search or sort algorithm? What rules shouldyou follow to ensure type-safe code? Whether you’re working alone orwith others, C++ Coding Standards will help you write cleaner code–andwrite it faster, with fewer hassles and less frustration.