mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
travis CI fixes
This commit is contained in:
parent
aabfe119d3
commit
85cb14703c
|
@ -2162,7 +2162,7 @@ We might write
|
|||
}
|
||||
istream& in = *inp;
|
||||
|
||||
This violated the ruly [against uninitialized variables](#Res-always),
|
||||
This violated the rule [against uninitialized variables](#Res-always),
|
||||
the rule against [ignoring ownership](#Ri-raw),
|
||||
and the rule [against magic constants](#Res-magic) .
|
||||
In particular, someone has to remember to somewhere write
|
||||
|
@ -2171,7 +2171,7 @@ In particular, someone has to remember to somewhere write
|
|||
|
||||
We could handle this particular example by using `unique_ptr` with a special deleter that does nothing for `cin`,
|
||||
but that's complicated for novices (who can easily encounter this problem) and the example is an example of a more general
|
||||
problem where a property that we would like to consider static (here, ownership) needs infrequesntly be addressed
|
||||
problem where a property that we would like to consider static (here, ownership) needs infrequently be addressed
|
||||
at run time.
|
||||
The common, most frequent, and safest examples can be handled statically, so we don't want to add cost and complexity to those.
|
||||
But we must also cope with the uncommon, less-safe, and necessarily more expensive cases.
|
||||
|
@ -6114,7 +6114,7 @@ This is not just slow, but if a memory allocation occurs for the elements in `tm
|
|||
|
||||
(Simple) When a class has a `swap` member function, it should be declared `noexcept`.
|
||||
|
||||
### <a name="Rc-swap-noexcept"></a>: C.85: Make `swap` `noexcept`
|
||||
### <a name="Rc-swap-noexcept"></a>C.85: Make `swap` `noexcept`
|
||||
|
||||
##### Reason
|
||||
|
||||
|
@ -7134,7 +7134,7 @@ This rule is about using `final` on classes with virtual functions meant to be i
|
|||
##### Note
|
||||
|
||||
Capping an individual virtual function with `final` is error-prone as `final` can easily be overlooked when defining/overriding a set of functions.
|
||||
Fortunately, the compiler catches such mistakes: You cannot re-declare/re-open a `final` member a derived class.
|
||||
Fortunately, the compiler catches such mistakes: You cannot re-declare/re-open a `final` member in a derived class.
|
||||
|
||||
##### Note
|
||||
|
||||
|
@ -11908,7 +11908,7 @@ Consider:
|
|||
auto a = area(height, 2); // if the input is -2 a becomes 4294967292
|
||||
|
||||
Remember that `-1` when assigned to an `unsigned int` becomes the largest `unsigned int`.
|
||||
Also, since unsigned arithmetic is modulo arithmentic the multiplication didn't overflow, it wrapped around.
|
||||
Also, since unsigned arithmetic is modulo arithmetic the multiplication didn't overflow, it wrapped around.
|
||||
|
||||
##### Example
|
||||
|
||||
|
@ -11959,15 +11959,19 @@ To enable better error detection.
|
|||
|
||||
vector<int> vec {1, 2, 3, 4, 5};
|
||||
|
||||
for (int i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // mix int and unsigned
|
||||
for (unsigned i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // risk wraparound
|
||||
for (vector<int>::size_type i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // verbose
|
||||
for (auto i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // mix int and unsigned
|
||||
for (int i=0; i < vec.size(); i+=2) // mix int and unsigned
|
||||
cout << vec[i] << '\n';
|
||||
for (unsigned i=0; i < vec.size(); i+=2) // risk wraparound
|
||||
cout << vec[i] << '\n';
|
||||
for (vector<int>::size_type i=0; i < vec.size(); i+=2) // verbose
|
||||
cout << vec[i] << '\n';
|
||||
for (auto i=0; i < vec.size(); i+=2) // mix int and unsigned
|
||||
cout << vec[i] << '\n';
|
||||
|
||||
##### Note
|
||||
|
||||
The built-in array uses signed subscripts.
|
||||
The standard-library containers use unsigned sunscripts.
|
||||
The standard-library containers use unsigned subscripts.
|
||||
Thus, no perfect and fully compatible solution is possible.
|
||||
Given the known problems with unsigned and signed/unsigned mixtures, better stick to (signed) integers.
|
||||
|
||||
|
@ -14266,7 +14270,7 @@ Instead, use a reference:
|
|||
|
||||
catch (exception& e) { /* ... */ }
|
||||
|
||||
of - typically better stil - a `const` reference:
|
||||
of - typically better still - a `const` reference:
|
||||
|
||||
catch (const exception& e) { /* ... */ }
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
'
|
||||
10'000
|
||||
0xFF0000
|
||||
0b0101'0101
|
||||
10x
|
||||
|
@ -184,6 +185,7 @@ g1
|
|||
g2
|
||||
GCC
|
||||
Geosoft
|
||||
getline
|
||||
getx
|
||||
GFM
|
||||
Girou
|
||||
|
@ -205,7 +207,9 @@ hnd
|
|||
homebrew
|
||||
HPL
|
||||
href
|
||||
HTTP
|
||||
Hyslop
|
||||
i2
|
||||
IDE
|
||||
IDEs
|
||||
IEC
|
||||
|
@ -480,6 +484,7 @@ stmt
|
|||
str
|
||||
strdup
|
||||
strlen
|
||||
Str15
|
||||
Stroustrup
|
||||
Stroustrup00
|
||||
Stroustrup05
|
||||
|
@ -527,6 +532,8 @@ typeid
|
|||
typename
|
||||
typesafe
|
||||
UB
|
||||
u1
|
||||
u2
|
||||
unaliased
|
||||
uncompromised
|
||||
underuse
|
||||
|
|
Loading…
Reference in New Issue
Block a user