<b>Conquer the Complexity of Modern C++</b> <blockquote> " <i>Beautiful C++</i> presents the C++ Core Guidelines from a developer's point of view with an emphasis on what benefits can be obtained from following the rules and what nightmares can result from ignoring them. For true geeks, it is an e
Beautiful C++: 30 Core Guidelines for Writing Clean, Safe, and Fast Code
β Scribed by J. Davidson, Kate Gregory
- Publisher
- Addison-Wesley Professional
- Year
- 2021
- Tongue
- English
- Leaves
- 346
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
Discover the Beauty of Modern C++
"Beautiful C++ presents the C++ Core Guidelines from a developer's point of view with an emphasis on what benefits can be obtained from following the rules and what nightmares can result from ignoring them. For true geeks, it is an easy and entertaining read. For most software developers, it offers something new and useful."
--Bjarne Stroustrup, inventor of C++ and co-editor of the C++ Core Guidelines
Writing great C++ code needn't be difficult. The C++ Core Guidelines can help every C++ developer design and write C++ programs that are exceptionally reliable, efficient, and well-performing. But the Guidelines are so jam-packed with excellent advice that it's hard to know where to start. Start here, with Beautiful C++.
Expert C++ programmers Guy Davidson and Kate Gregory identify 30 Core Guidelines you'll find especially valuable and offer detailed practical knowledge for improving your C++ style. For easy reference, this book is structured to align closely with the official C++ Core Guidelines website.
Throughout, Davidson and Gregory offer useful conceptual insights and expert sample code, illuminate proven ways to use both new and longstanding language features more successfully, and show how to write programs that are more robust and performant by default.
- Avoid "bikeshedding": stop wasting valuable time on trivia
- Don't hurt yourself by writing code that will cause problems later
- Know which legacy features to avoid and the modern features to use instead
- Use newer features properly, to get their benefits without creating new problems
- Default to higher-quality code that's statically type-safe, leak resistant, and easier to evolve
- Use the Core Guidelines with any modern C++ version: C++20, C++17, C++14, or C++11
There's something here to improve virtually every program you write, design, or maintain.
For ease of experimentation, all sample code is available on Compiler Explorer at https://godbolt.org/z/cg30-ch0.0.
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
β¦ Table of Contents
Cover
Half Title
Title
Copyright
Dedication
Contents
List of Selected C++ Core Guidelines
Foreword
Preface
Acknowledgments
About the Authors
Section 1 Bikeshedding is bad
Chapter 1.1 P.2: Write in ISO Standard C++
Chapter 1.2 F.51: Where there is a choice, prefer default arguments over overloading
Chapter 1.3 C.45: Donβt define a default constructor that only initializes data members; use in-class member initializers instead
Chapter 1.4 C.131: Avoid trivial getters and setters
Chapter 1.5 ES.10: Declare one name (only) per declaration
Chapter 1.6 NR.2: Donβt insist to have only a single return-statement in a function
Section 2 Donβt hurt yourself
Chapter 2.1 P.11: Encapsulate messy constructs, rather than spreading through the code
Chapter 2.2 I.23: Keep the number of function arguments low
Chapter 2.3 I.26: If you want a cross-compiler ABI, use a C-style subset
Chapter 2.4 C.47: Define and initialize member variables in the order of member declaration
Chapter 2.5 CP.3: Minimize explicit sharing of writable data
Chapter 2.6 T.120: Use template metaprogramming only when you really need to
Section 3 Stop using that
Chapter 3.1 I.11: Never transfer ownership by a raw pointer (T*) or reference (T&)
Chapter 3.2 I.3: Avoid singletons
Chapter 3.3 C.90: Rely on constructors and assignment operators, not memset and memcpy
Chapter 3.4 ES.50: Donβt cast away const
Chapter 3.5 E.28: Avoid error handling based on global state (e.g. errno)
Chapter 3.6 SF.7: Donβt write using namespace at global scope in a header file
Section 4 Use this new thing properly
Chapter 4.1 F.21: To return multiple βoutβ values, prefer returning a struct or tuple
Chapter 4.2 Enum.3: Prefer class enums over βplainβ enums
Chapter 4.3 ES.5: Keep scopes small
Chapter 4.4 Con.5: Use constexpr for values that can be computed at compile time
Chapter 4.5 T.1: Use templates to raise the level of abstraction of code
Chapter 4.6 T.10: Specify concepts for all template arguments
Section 5 Write code well by default
Chapter 5.1 P.4: Ideally, a program should be statically type safe
Chapter 5.2 P.10: Prefer immutable data to mutable data
Chapter 5.3 I.30: Encapsulate rule violations
Chapter 5.4 ES.22: Donβt declare a variable until you have a value to initialize it with
Chapter 5.5 Per.7: Design to enable optimization
Chapter 5.6 E.6: Use RAII to prevent leaks
Envoi
Afterword
Index
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
Y
Z
β¦ Subjects
C++ Programming; Software Development; Software Development Guidelines; Software Development Best Practices; Core Guidelines; Best Practices; C++11; C++14; C++17; C++20
π SIMILAR VOLUMES
<b>Discover the Beauty of Modern C++</b> <blockquote> " <i>Beautiful C++</i> presents the C++ Core Guidelines from a developer's point of view with an emphasis on what benefits can be obtained from following the rules and what nightmares can result from ignoring them. For true geeks, it is an eas
<p><span>Discover the Beauty of Modern C++</span></p><span> " </span><span>Beautiful C++</span><span>Β presents the C++ Core Guidelines from a developer's point of view with an emphasis on what benefits can be obtained from following the rules and what nightmares can result from ignoring them. For tr
<p><span>"</span><span>Python Clean Code</span><span>" is a comprehensive guidebook for Python developers who want to improve the quality of their code by adopting best practices for writing clean, readable, and maintainable code. The book is authored by </span><span>Nash Maverick</span><span>, who
<p><span>"</span><span>Python Clean Code</span><span>" is a comprehensive guidebook for Python developers who want to improve the quality of their code by adopting best practices for writing clean, readable, and maintainable code. The book is authored by </span><span>Nash Maverick</span><span>, who