Maximize Reward and Minimize Risk with Modern C++ Embracing Modern C++ Safely shows you how to make effective use of the new and enhanced language features of modern C++ without falling victim to their potential pitfalls. Based on their years of experience with large, mission-critical projects, four leading C++ authorities divide C++11/14 language features into three categories: Safe, Conditionally Safe, and Unsafe. Safe features offer compelling value, are easy to use productively, and are relatively difficult to misuse. Conditionally safe features offer significant value but come with risks that require significant expertise and familiarity before use. Unsafe features have an especially poor risk/reward ratio, are easy to misuse, and are beneficial in only the most specialized circumstances. This book distills the C++ community's years of experience applying C++11 and C++14 features and will help you make effective and safe design decisions that reflect real-world, economic engineering tradeoffs in large-scale, diverse software development environments. The authors use examples derived from real code bases to illustrate every finding objectively and to illuminate key issues. Each feature identifies the sound use cases, hidden pitfalls, and shortcomings of that language feature. After reading this book, you will Understand what each C++11/14 feature does and where it works bestRecognize how to work around show-stopping pitfalls and annoying corner casesKnow which features demand additional training, experience, and peer reviewGain insights for preparing coding standards and style guides that suit your organization's needsBe equipped to introduce modern C++ incrementally and judiciously into established code bases Seasoned C++ developers, team leads, and technical managers who want to improve productivity, code quality, and maintainability will find the insights in this modular, meticulously organized reference indispensable. Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Les mer
Foreword by Shawn Edwards xiiiForeword by Andrei Alexandrescu xvAcknowledgments xixAbout the Authors xxv Chapter 0: Introduction 1 What Makes This Book Different 1Scope for the First Edition 2The EMC++S Guiding Principles 3What Do We Mean by Safely? 4A Safe Feature 5A Conditionally Safe Feature 5An Unsafe Feature 6Modern C++ Feature Catalog 6How to Use This Book 8 Chapter 1: Safe Features 11 1.1 C++11 11Attribute Syntax | Generalized Attribute Support 12Consecutive >s | Consecutive Right-Angle Brackets 21decltype | Operator for Extracting Expression Types 25Defaulted Functions | Using = default for Special Member Functions 33Delegating Ctors | Constructors Calling Other Constructors 46Deleted Functions | Using = delete for Arbitrary Functions 53explicit Operators | Explicit Conversion Operators 61Function static '11 | Thread-Safe Function-Scope static Variables 68Local Types '11 | Local/Unnamed Types as Template Arguments 83long long | The long long (≥64 bits) Integral Type 89noreturn | The [[noreturn]] Attribute 95nullptr | The Null-Pointer-Literal Keyword 99override | The override Member-Function Specifier 104Raw String Literals | Syntax for Unprocessed String Contents 108static_assert | Compile-Time Assertions 115Trailing Return | Trailing Function Return Types 124Unicode Literals | Unicode String Literals 129using Aliases | Type/Template Aliases (Extended typedef) 133 1.2 C++14 138Aggregate Init '14 | Aggregates Having Default Member Initializers 138Binary Literals | Binary Literals: The 0b Prefix 142deprecated | The [[deprecated]] Attribute 147Digit Separators | The Digit Separator (') 152Variable Templates | Templated Variable Declarations/Definitions 157 Chapter 2: Conditionally Safe Features 167 2.1 C++11 167alignas | The alignas Specifier 168alignof | The alignof Operator 184auto Variables | Variables of Automatically Deduced Type 195Braced Init | Braced-Initialization Syntax: {} 215constexpr Functions | Compile-Time Invocable Functions 257constexpr Variables | Compile-Time Accessible Variables 302Default Member Init | Default class/union Member Initializers 318enum class | Strongly Typed, Scoped Enumerations 332extern template | Explicit-Instantiation Declarations 353Forwarding References | Forwarding References (T&&) 377Generalized PODs '11 | Trivial and Standard-Layout Types 401Inheriting Ctors | Inheriting Base-Class Constructors 535initializer_list | List Initialization: std::initializer_list 553Lambdas | Anonymous Function Objects (Closures) 573noexcept Operator | Asking if an Expression Cannot throw 615Opaque enums | Opaque Enumeration Declarations 660Range for | Range-Based for Loops 679Rvalue References | Move Semantics and Rvalue References (&&) 710Underlying Type '11 | Explicit Enumeration Underlying Type 829User-Defined Literals | User-Defined Literal Operators 835Variadic Templates | Variable-Argument-Count Templates 873 2.2 C++14 958constexpr Functions '14 | Relaxed Restrictions on constexpr Functions 959Generic Lambdas | Lambdas Having a Templated Call Operator 968Lambda Captures | Lambda-Capture Expressions 986 Chapter 3: Unsafe Features 997 3.1 C++11 997carries_dependency | The [[carries_dependency]] Attribute 998final | Prohibiting Overriding and Derivation 1007friend '11 | Extended friend Declarations 1031inline namespace | Transparently Nested Namespaces 1055noexcept Specifier | The noexcept Function Specification 1085Ref-Qualifiers | Reference-Qualified Member Functions 1153union '11 | Unions Having Non-Trivial Members 1174 3.2 C++14 1182auto Return | Function (auto) Return-Type Deduction 1182decltype(auto) | Deducing Types Using decltype Semantics 1205 Afterword: Looking Back and Looking Forward 1215 Glossary 1217Bibliography 1281Index 1305
Les mer
Focused on what experienced C++ developers need to succeed with C++14, C++11, and other modern versions of C++Stresses real-life application issues, and problems that arise when engineers with diverse C++ experience collaborateFact-based, data-driven, objective, and packed with realistic examples from the deep C++ experience the authors possess
Les mer
Produktdetaljer
ISBN
9780137380350
Publisert
2022-02-16
Utgiver
Vendor
Addison Wesley
Vekt
2200 gr
Høyde
232 mm
Bredde
180 mm
Dybde
50 mm
Aldersnivå
P, 06
Språk
Product language
Engelsk
Format
Product format
Heftet
Antall sider
1376
Biographical note
Dr. John Lakos is a senior architect and mentor for software development at Bloomberg LP, where he created the BDE team (c. 2001), which maintains Bloomberg's open-source foundation libraries for C++ development worldwide. He is the author of Large-Scale C++ Software Design and Large-Scale C++ Volume I: Process and Architecture (both from Addison-Wesley), and is an active voting member of the C++ Standards Committee.Vittorio Romeo is a senior software engineer at Bloomberg, building mission-critical C++ middleware and training colleagues on modern C++. He is also the creator of many open-source C++ libraries and games.
Dr. Rostislav Khlebnikov is a team lead and senior software engineer in Bloomberg's BDE team, where he directs the development of high-performance C++ foundation software.
Alisdair Meredith is a senior software engineer in Bloomberg's BDE team and a long-standing member of the C++ Standards Committee, where he was the Chair of its Library Working Group between 2010 and 2015.