Skip to content

Commit 34d6c79

Browse files
committed
Escape slashes to fix footnote warnings
1 parent c06c6b2 commit 34d6c79

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

CppCoreGuidelines.md

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5504,8 +5504,6 @@ This rule applies to all the usual comparison operators: `!=`, `<`, `<=`, `>`, a
55045504

55055505
* Flag a virtual `operator==()`; same for other comparison operators: `!=`, `<`, `<=`, `>`, and `>=`.
55065506

5507-
5508-
55095507
### <a name="Rc-hash"></a>C.89: Make a `hash` `noexcept`
55105508

55115509
##### Reason
@@ -5698,7 +5696,6 @@ Interfaces should normally be composed entirely of public pure virtual functions
56985696
The `Derived` is `delete`d through its `Goof` interface, so its `string` is leaked.
56995697
Give `Goof` a virtual destructor and all is well.
57005698

5701-
57025699
##### Enforcement
57035700

57045701
* Warn on any class that contains data members and also has an overridable (non-`final`) virtual function.
@@ -6116,7 +6113,6 @@ However, misuses are (or at least has been) far more common.
61166113

61176114
Flag uses of `final`.
61186115

6119-
61206116
## <a name="Rh-virtual-default-arg"></a>C.140: Do not provide different default arguments for a virtual function and an overrider
61216117

61226118
##### Reason
@@ -9634,7 +9630,6 @@ In general, don't complicate your code without reason (??)
96349630
Never write `return move(local_variable);`, because the language already knows the variable is a move candidate.
96359631
Writing `move` in this code won't help, and can actually be detrimental because on some compilers it interferes with RVO (the return value optimization) by creating an additional reference alias to the local variable.
96369632

9637-
96389633
##### Example, bad
96399634

96409635
vector<int> v = std::move(make_vector()); // bad; the std::move is entirely redundant
@@ -15004,7 +14999,7 @@ If the class definition and the constructor body are in separate files, the long
1500414999

1500515000
**References**:
1500615001

15007-
[[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
15002+
[\[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
1500815003

1500915004
### <a name="TBD"></a>Use of `=`, `{}`, and `()` as initializers
1501015005

@@ -15016,7 +15011,7 @@ If your design wants virtual dispatch into a derived class from a base class con
1501615011

1501715012
* *Pass the buck:* Just document that user code must call the post-initialization function right after constructing an object.
1501815013
* *Post-initialize lazily:* Do it during the first call of a member function. A Boolean flag in the base class tells whether or not post-construction has taken place yet.
15019-
* *Use virtual base class semantics:* Language rules dictate that the constructor most-derived class decides which base constructor will be invoked; you can use that to your advantage. (See [[Taligent94]](#Taligent94).)
15014+
* *Use virtual base class semantics:* Language rules dictate that the constructor most-derived class decides which base constructor will be invoked; you can use that to your advantage. (See [\[Taligent94\]](#Taligent94).)
1502015015
* *Use a factory function:* This way, you can easily force a mandatory invocation of a post-constructor function.
1502115016

1502215017
Here is an example of the last option:
@@ -15071,7 +15066,7 @@ If the requirements above are met, the design guarantees that `PostInitialize` h
1507115066

1507215067
In summary, no post-construction technique is perfect. The worst techniques dodge the whole issue by simply asking the caller to invoke the post-constructor manually. Even the best require a different syntax for constructing objects (easy to check at compile time) and/or cooperation from derived class authors (impossible to check at compile time).
1507315068

15074-
**References**: [[Alexandrescu01]](#Alexandrescu01) §3, [[Boost]](#Boost), [[Dewhurst03]](#Dewhurst03) §75, [[Meyers97]](#Meyers97) §46, [[Stroustrup00]](#Stroustrup00) §15.4.3, [[Taligent94]](#Taligent94)
15069+
**References**: [\[Alexandrescu01\]](#Alexandrescu01) §3, [\[Boost\]](#Boost), [\[Dewhurst03\]](#Dewhurst03) §75, [\[Meyers97\]](#Meyers97) §46, [\[Stroustrup00\]](#Stroustrup00) §15.4.3, [\[Taligent94\]](#Taligent94)
1507515070

1507615071
### <a name="Sd-dtor"></a>Discussion: Make base class destructors public and virtual, or protected and nonvirtual
1507715072

@@ -15142,7 +15137,7 @@ In this rare case, you could make the destructor public and nonvirtual but clear
1514215137

1514315138
In general, however, avoid concrete base classes (see Item 35). For example, `unary_function` is a bundle-of-typedefs that was never intended to be instantiated standalone. It really makes no sense to give it a public destructor; a better design would be to follow this Item's advice and give it a protected nonvirtual destructor.
1514415139

15145-
**References**: [[C++CS]](#C++CS) Item 50, [[Cargill92]](#Cargill92) pp. 77-79, 207¸ [[Cline99]](#Cline99) §21.06, 21.12-13¸ [[Henricson97]](#Henricson97) pp. 110-114¸ [[Koenig97]](#Koenig97) Chapters 4, 11¸ [[Meyers97]](#Meyers97) §14¸ [[Stroustrup00]](#Stroustrup00) §12.4.2¸ [[Sutter02]](#Sutter02) §27¸ [[Sutter04]](#Sutter04) §18
15140+
**References**: [\[C++CS\]](#C++CS) Item 50, [\[Cargill92\]](#Cargill92) pp. 77-79, 207¸ [\[Cline99\]](#Cline99) §21.06, 21.12-13¸ [\[Henricson97\]](#Henricson97) pp. 110-114¸ [\[Koenig97\]](#Koenig97) Chapters 4, 11¸ [\[Meyers97\]](#Meyers97) §14¸ [\[Stroustrup00\]](#Stroustrup00) §12.4.2¸ [\[Sutter02\]](#Sutter02) §27¸ [\[Sutter04\]](#Sutter04) §18
1514615141

1514715142
### <a name="Sd-noexcept"></a>Discussion: Usage of noexcept
1514815143

@@ -15216,9 +15211,9 @@ These are key functions that must not fail because they are necessary for the tw
1521615211

1521715212
Consider the following advice and requirements found in the C++ Standard:
1521815213

15219-
> If a destructor called during stack unwinding exits with an exception, terminate is called (15.5.1). So destructors should generally catch exceptions and not let them propagate out of the destructor. --[[C++03]](#C++03) §15.2(3)
15214+
> If a destructor called during stack unwinding exits with an exception, terminate is called (15.5.1). So destructors should generally catch exceptions and not let them propagate out of the destructor. --[\[C++03\]](#C++03) §15.2(3)
1522015215
>
15221-
> No destructor operation defined in the C++ Standard Library (including the destructor of any type that is used to instantiate a standard library template) will throw an exception. --[[C++03]](#C++03) §17.4.4.8(3)
15216+
> No destructor operation defined in the C++ Standard Library (including the destructor of any type that is used to instantiate a standard library template) will throw an exception. --[\[C++03\]](#C++03) §17.4.4.8(3)
1522215217

1522315218
Deallocation functions, including specifically overloaded `operator delete` and `operator delete[]`, fall into the same category, because they too are used during cleanup in general, and during exception handling in particular, to back out of partial work that needs to be undone.
1522415219
Besides destructors and deallocation functions, common error-safety techniques rely also on `swap` operations never failing--in this case, not because they are used to implement a guaranteed rollback, but because they are used to implement a guaranteed commit. For example, here is an idiomatic implementation of `operator=` for a type `T` that performs copy construction followed by a call to a no-fail `swap`:
@@ -15234,7 +15229,7 @@ Fortunately, when releasing a resource, the scope for failure is definitely smal
1523415229

1523515230
When using exceptions as your error handling mechanism, always document this behavior by declaring these functions `noexcept`. (See Item 75.)
1523615231

15237-
**References**: [[C++CS]](#C++CS) Item 51; [[C++03]](#C++03) §15.2(3), §17.4.4.8(3)¸ [[Meyers96]](#Meyers96) §11¸ [[Stroustrup00]](#Stroustrup00) §14.4.7, §E.2-4¸ [[Sutter00]](#Sutter00) §8, §16¸ [[Sutter02]](#Sutter02) §18-19
15232+
**References**: [\[C++CS\]](#C++CS) Item 51; [\[C++03\]](#C++03) §15.2(3), §17.4.4.8(3)¸ [\[Meyers96\]](#Meyers96) §11¸ [\[Stroustrup00\]](#Stroustrup00) §14.4.7, §E.2-4¸ [\[Sutter00\]](#Sutter00) §8, §16¸ [\[Sutter02\]](#Sutter02) §18-19
1523815233

1523915234
## <a name="Sd-consistent"></a>Define Copy, move, and destroy consistently
1524015235

@@ -15320,7 +15315,7 @@ Prefer compiler-generated (including `=default`) special members; only these can
1532015315
In rare cases, classes that have members of strange types (such as reference members) are an exception because they have peculiar copy semantics.
1532115316
In a class holding a reference, you likely need to write the copy constructor and the assignment operator, but the default destructor already does the right thing. (Note that using a reference member is almost always wrong.)
1532215317

15323-
**References**: [[C++CS]](#C++CS) Item 52; [[Cline99]](#Cline99) §30.01-14¸ [[Koenig97]](#Koenig97) §4¸ [[Stroustrup00]](#Stroustrup00) §5.5, §10.4¸ [[SuttHysl04b]](#SuttHysl04b)
15318+
**References**: [\[C++CS\]](#C++CS) Item 52; [\[Cline99\]](#Cline99) §30.01-14¸ [\[Koenig97\]](#Koenig97) §4¸ [\[Stroustrup00\]](#Stroustrup00) §5.5, §10.4¸ [\[SuttHysl04b\]](#SuttHysl04b)
1532415319

1532515320
Resource management rule summary:
1532615321

@@ -15724,49 +15719,49 @@ Alternatively, we will decide that no change is needed and delete the entry.
1572415719
# Bibliography
1572515720

1572615721
* <a name="Alexandrescu01"></a>
15727-
[Alexandrescu01]: A. Alexandrescu. Modern C++ Design (Addison-Wesley, 2001).
15722+
\[Alexandrescu01]: A. Alexandrescu. Modern C++ Design (Addison-Wesley, 2001).
1572815723
* <a name="Cplusplus03"></a>
15729-
[C++03]: ISO/IEC 14882:2003(E), Programming Languages — C++ (updated ISO and ANSI C++ Standard including the contents of (C++98) plus errata corrections).
15724+
\[C++03]: ISO/IEC 14882:2003(E), Programming Languages — C++ (updated ISO and ANSI C++ Standard including the contents of (C++98) plus errata corrections).
1573015725
* <a name="CplusplusCS"></a>
15731-
[C++CS]:
15726+
\[C++CS]:
1573215727
* <a name="Cargill92"></a>
15733-
[Cargill92]: T. Cargill. C++ Programming Style (Addison-Wesley, 1992).
15728+
\[Cargill92]: T. Cargill. C++ Programming Style (Addison-Wesley, 1992).
1573415729
* <a name="Cline99"></a>
15735-
[Cline99]: M. Cline, G. Lomow, and M. Girou. C++ FAQs (2ndEdition) (Addison-Wesley, 1999).
15730+
\[Cline99]: M. Cline, G. Lomow, and M. Girou. C++ FAQs (2ndEdition) (Addison-Wesley, 1999).
1573615731
* <a name="Dewhurst03"></a>
15737-
[Dewhurst03]: S. Dewhurst. C++ Gotchas (Addison-Wesley, 2003).
15732+
\[Dewhurst03]: S. Dewhurst. C++ Gotchas (Addison-Wesley, 2003).
1573815733
* <a name="Henricson97"></a>
15739-
[Henricson97]: M. Henricson and E. Nyquist. Industrial Strength C++ (Prentice Hall, 1997).
15734+
\[Henricson97]: M. Henricson and E. Nyquist. Industrial Strength C++ (Prentice Hall, 1997).
1574015735
* <a name="Koenig97"></a>
15741-
[Koenig97]: A. Koenig and B. Moo. Ruminations on C++ (Addison-Wesley, 1997).
15736+
\[Koenig97]: A. Koenig and B. Moo. Ruminations on C++ (Addison-Wesley, 1997).
1574215737
* <a name="Lakos96"></a>
15743-
[Lakos96]: J. Lakos. Large-Scale C++ Software Design (Addison-Wesley, 1996).
15738+
\[Lakos96]: J. Lakos. Large-Scale C++ Software Design (Addison-Wesley, 1996).
1574415739
* <a name="Meyers96"></a>
15745-
[Meyers96]: S. Meyers. More Effective C++ (Addison-Wesley, 1996).
15740+
\[Meyers96]: S. Meyers. More Effective C++ (Addison-Wesley, 1996).
1574615741
* <a name="Meyers97"></a>
15747-
[Meyers97]: S. Meyers. Effective C++ (2nd Edition) (Addison-Wesley, 1997).
15742+
\[Meyers97]: S. Meyers. Effective C++ (2nd Edition) (Addison-Wesley, 1997).
1574815743
* <a name="Meyers15"></a>
15749-
[Meyers15]: S. Meyers. Effective Modern C++ (O'Reilly, 2015).
15744+
\[Meyers15]: S. Meyers. Effective Modern C++ (O'Reilly, 2015).
1575015745
* <a name="Murray93"></a>
15751-
[Murray93]: R. Murray. C++ Strategies and Tactics (Addison-Wesley, 1993).
15746+
\[Murray93]: R. Murray. C++ Strategies and Tactics (Addison-Wesley, 1993).
1575215747
* <a name="Stroustrup00"></a>
15753-
[Stroustrup00]: B. Stroustrup. The C++ Programming Language (Special 3rdEdition) (Addison-Wesley, 2000).
15748+
\[Stroustrup00]: B. Stroustrup. The C++ Programming Language (Special 3rdEdition) (Addison-Wesley, 2000).
1575415749
* <a name="Stroustrup05"></a>
15755-
[Stroustrup05]: B. Stroustrup. [A rationale for semantically enhanced library languages](http://www.stroustrup.com/SELLrationale.pdf).
15750+
\[Stroustrup05]: B. Stroustrup. [A rationale for semantically enhanced library languages](http://www.stroustrup.com/SELLrationale.pdf).
1575615751
* <a name="Stroustrup13"></a>
15757-
[Stroustrup13]: B. Stroustrup. [The C++ Programming Language (4th Edition)](http://www.stroustrup.com/4th.html). Addison Wesley 2013.
15752+
\[Stroustrup13]: B. Stroustrup. [The C++ Programming Language (4th Edition)](http://www.stroustrup.com/4th.html). Addison Wesley 2013.
1575815753
* <a name="Stroustrup14"></a>
15759-
[Stroustrup14]: B. Stroustrup. [A Tour of C++](http://www.stroustrup.com/Tour.html).
15754+
\[Stroustrup14]: B. Stroustrup. [A Tour of C++](http://www.stroustrup.com/Tour.html).
1576015755
Addison Wesley 2014.
1576115756
* <a name="SuttHysl04b"></a>
15762-
[SuttHysl04b]: H. Sutter and J. Hyslop. "Collecting Shared Objects" (C/C++ Users Journal, 22(8), August 2004).
15757+
\[SuttHysl04b]: H. Sutter and J. Hyslop. "Collecting Shared Objects" (C/C++ Users Journal, 22(8), August 2004).
1576315758
* <a name="SuttAlex05"></a>
15764-
[SuttAlex05]: H. Sutter and A. Alexandrescu. C++ Coding Standards. Addison-Wesley 2005.
15759+
\[SuttAlex05]: H. Sutter and A. Alexandrescu. C++ Coding Standards. Addison-Wesley 2005.
1576515760
* <a name="Sutter00"></a>
15766-
[Sutter00]: H. Sutter. Exceptional C++ (Addison-Wesley, 2000).
15761+
\[Sutter00]: H. Sutter. Exceptional C++ (Addison-Wesley, 2000).
1576715762
* <a name="Sutter02"></a>
15768-
[Sutter02]: H. Sutter. More Exceptional C++ (Addison-Wesley, 2002).
15763+
\[Sutter02]: H. Sutter. More Exceptional C++ (Addison-Wesley, 2002).
1576915764
* <a name="Sutter04"></a>
15770-
[Sutter04]: H. Sutter. Exceptional C++ Style (Addison-Wesley, 2004).
15765+
\[Sutter04]: H. Sutter. Exceptional C++ Style (Addison-Wesley, 2004).
1577115766
* <a name="Taligent94"></a>
15772-
[Taligent94]: Taligent's Guide to Designing Programs (Addison-Wesley, 1994).
15767+
\[Taligent94]: Taligent's Guide to Designing Programs (Addison-Wesley, 1994).

0 commit comments

Comments
 (0)