labels missing

#938. I have inserted a temporary fix. We need to re-work the whole
discussions section
This commit is contained in:
Bjarne Stroustrup 2017-06-12 16:54:38 -04:00
parent 5e2f9064b2
commit 5393fab88f

View File

@ -19816,9 +19816,9 @@ Most of the concepts below are defined in [the Ranges TS](http://www.open-std.or
* `Relation`
* ...
### <a name="SS-gsl-smartptrconcepts"></a>Smart pointer concepts
### <a name="SS-gsl-smartptrconcepts"></a>GSL.ptr: Smart pointer concepts
Described in [Lifetimes paper](https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/Lifetimes%20I%20and%20II%20-%20v0.9.1.pdf).
See [Lifetimes paper](https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/Lifetimes%20I%20and%20II%20-%20v0.9.1.pdf).
# <a name="S-naming"></a>NL: Naming and layout rules
@ -20579,7 +20579,7 @@ If the class definition and the constructor body are in separate files, the long
[\[Cline99\]](#Cline99) §22.03-11, [\[Dewhurst03\]](Dewhurst03) §52-53, [\[Koenig97\]](#Koenig97) §4, [\[Lakos96\]](#Lakos96) §10.3.5, [\[Meyers97\]](#Meyers97) §13, [\[Murray93\]](#Murray93) §2.1.3, [\[Sutter00\]](#Sutter00) §47
### <a name="TBD"></a>Use of `=`, `{}`, and `()` as initializers
### <a name="Sd-init"></a>Discussion: Use of `=`, `{}`, and `()` as initializers
???
@ -20906,7 +20906,7 @@ Resource management rule summary:
* [If a class is a resource handle, it needs a constructor, a destructor, and copy and/or move operations](#Cr-handle)
* [If a class is a container, give it an initializer-list constructor](#Cr-list)
### <a name="Cr-safety"></a>Provide strong resource safety; that is, never leak anything that you think of as a resource
### <a name="Cr-safety"></a>Discussion: Provide strong resource safety; that is, never leak anything that you think of as a resource
##### Reason
@ -20934,7 +20934,7 @@ This class is a resource handle. It manages the lifetime of the `T`s. To do so,
The basic technique for preventing leaks is to have every resource owned by a resource handle with a suitable destructor. A checker can find "naked `new`s". Given a list of C-style allocation functions (e.g., `fopen()`), a checker can also find uses that are not managed by a resource handle. In general, "naked pointers" can be viewed with suspicion, flagged, and/or analyzed. A complete list of resources cannot be generated without human input (the definition of "a resource" is necessarily too general), but a tool can be "parameterized" with a resource list.
### <a name="Cr-never"></a>Never throw while holding a resource not owned by a handle
### <a name="Cr-never"></a>Discussion: Never throw while holding a resource not owned by a handle
##### Reason
@ -20979,7 +20979,7 @@ A checker probably must rely on a human-provided list of resources.
For starters, we know about the standard-library containers, `string`, and smart pointers.
The use of `span` and `string_span` should help a lot (they are not resource handles).
### <a name="Cr-raw"></a>A "raw" pointer or reference is never a resource handle
### <a name="Cr-raw"></a>Discussion: A "raw" pointer or reference is never a resource handle
##### Reason
@ -20989,7 +20989,7 @@ To be able to distinguish owners from views.
This is independent of how you "spell" pointer: `T*`, `T&`, `Ptr<T>` and `Range<T>` are not owners.
### <a name="Cr-outlive"></a>Never let a pointer outlive the object it points to
### <a name="Cr-outlive"></a>Discussion: Never let a pointer outlive the object it points to
##### Reason
@ -21020,7 +21020,7 @@ The `string`s of `v` are destroyed upon exit from `bad()` and so is `v` itself.
Most compilers already warn about simple cases and has the information to do more. Consider any pointer returned from a function suspect. Use containers, resource handles, and views (e.g., `span` known not to be resource handles) to lower the number of cases to be examined. For starters, consider every class with a destructor as resource handle.
### <a name="Cr-templates"></a>Use templates to express containers (and other resource handles)
### <a name="Cr-templates"></a>Discussion: Use templates to express containers (and other resource handles)
##### Reason
@ -21034,7 +21034,7 @@ To provide statically type-safe manipulation of elements.
int sz;
};
### <a name="Cr-value-return"></a>Return containers by value (relying on move or copy elision for efficiency)
### <a name="Cr-value-return"></a>Discussion: Return containers by value (relying on move or copy elision for efficiency)
##### Reason
@ -21057,7 +21057,7 @@ See the Exceptions in [F.20](#Rf-out).
Check for pointers and references returned from functions and see if they are assigned to resource handles (e.g., to a `unique_ptr`).
### <a name="Cr-handle"></a>If a class is a resource handle, it needs a constructor, a destructor, and copy and/or move operations
### <a name="Cr-handle"></a>Discussion: If a class is a resource handle, it needs a constructor, a destructor, and copy and/or move operations
##### Reason
@ -21082,7 +21082,7 @@ Now `Named` has a default constructor, a destructor, and efficient copy and move
In general, a tool cannot know if a class is a resource handle. However, if a class has some of [the default operations](#SS-ctor), it should have all, and if a class has a member that is a resource handle, it should be considered as resource handle.
### <a name="Cr-list"></a>If a class is a container, give it an initializer-list constructor
### <a name="Cr-list"></a>Discussion: If a class is a container, give it an initializer-list constructor
##### Reason