This commit is contained in:
Bjarne Stroustrup 2017-04-17 16:00:05 -04:00
parent f1d3846300
commit e144bd4f9b

View File

@ -60,37 +60,38 @@ Supporting sections:
* [Glossary](#S-glossary) * [Glossary](#S-glossary)
* [To-do: Unclassified proto-rules](#S-unclassified) * [To-do: Unclassified proto-rules](#S-unclassified)
or look at a specific language feature: You can look at a specific language feature:
* [assignment](#S-???) * assignment: [???](#S-???)
* [`class`](#S-class) * `class`: [???](#S-class)
* [constructor](#SS-ctor) * constructor: [???](#SS-ctor)
* [derived `class`](#SS-hier) * derived `class`: [???](#SS-hier)
* destructor: [and constructors](#Rc-matched), [when needed?](#Rc-dtor), [may not fail](#Rc-dtor-fail) * destructor: [and constructors](#Rc-matched), [when needed?](#Rc-dtor), [may not fail](#Rc-dtor-fail)
* [exception](#S-errors) * exception: [???](#S-errors)
* `for`: [range-for and for](#Res-for-range), [for and while](#Res-for-while) [for-initializer](#Res-for-init), [empty body](#Res-empty), [loop variable](#Res-loop-counter), [loop variable type ???](#Res-???) * `for`: [range-for and for](#Res-for-range) -- [for and while](#Res-for-while) -- [for-initializer](#Res-for-init) -- [empty body](#Res-empty) -- [loop variable](#Res-loop-counter) -- [loop variable type ???](#Res-???)
* [`inline`](#S-class) * `inline`: [???](#S-class)
* [initialization](#S-???) * initialization: [???](#S-???)
* [lambda expression](#SS-lambdas) * lambda expression: [???](#SS-lambdas)
* [operator](#S-???) * operator: [???](#S-???)
* [`public`, `private`, and `protected`](#S-???) * `public`, `private`, and `protected`: [???]](#S-???)
* [`static_assert`](#S-???) * `static_assert`: [???](#S-???)
* `struct`: [for organizing data](#Rc-org), [use if no invariant](#Rc-struct), [no private members](#Rc-class) * `struct`: [for organizing data](#Rc-org), [use if no invariant](#Rc-struct), [no private members](#Rc-class)
* [`template`](#S-???) * `template`: [???](#S-???)
* [`unsigned`](#S-???) * `unsigned`: [???](#S-???)
* [`virtual`](#SS-hier) * `virtual`: [???](#SS-hier)
Definitions of terms used to express and discuss the rules, that are not language-technical, but refer to design and programming techniques You can look at design concepts used to express the rules:
* error * assertion: ???
* exception * error: ???
* failure * exception: [exception guarantee[(???)]
* invariant * failure: ???
* leak * invariant: ???
* precondition * leak: ???
* postcondition * library: ???
* resource * precondition: ???
* exception guarantee * postcondition: ???
* resource: ???
# <a name="S-abstract"></a>Abstract # <a name="S-abstract"></a>Abstract
@ -99,7 +100,7 @@ The aim of this document is to help people to use modern C++ effectively.
By "modern C++" we mean C++11 and C++14 (and soon C++17). By "modern C++" we mean C++11 and C++14 (and soon C++17).
In other words, what would you like your code to look like in 5 years' time, given that you can start now? In 10 years' time? In other words, what would you like your code to look like in 5 years' time, given that you can start now? In 10 years' time?
The guidelines are focused on relatively higher-level issues, such as interfaces, resource management, memory management, and concurrency. The guidelines are focused on relatively high-level issues, such as interfaces, resource management, memory management, and concurrency.
Such rules affect application architecture and library design. Such rules affect application architecture and library design.
Following the rules will lead to code that is statically type safe, has no resource leaks, and catches many more programming logic errors than is common in code today. Following the rules will lead to code that is statically type safe, has no resource leaks, and catches many more programming logic errors than is common in code today.
And it will run fast -- you can afford to do things right. And it will run fast -- you can afford to do things right.