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;
|
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),
|
the rule against [ignoring ownership](#Ri-raw),
|
||||||
and the rule [against magic constants](#Res-magic) .
|
and the rule [against magic constants](#Res-magic) .
|
||||||
In particular, someone has to remember to somewhere write
|
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`,
|
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
|
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.
|
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.
|
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.
|
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`.
|
(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
|
##### Reason
|
||||||
|
|
||||||
|
@ -7134,7 +7134,7 @@ This rule is about using `final` on classes with virtual functions meant to be i
|
||||||
##### Note
|
##### Note
|
||||||
|
|
||||||
Capping an individual virtual function with `final` is error-prone as `final` can easily be overlooked when defining/overriding a set of functions.
|
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
|
##### Note
|
||||||
|
|
||||||
|
@ -11908,7 +11908,7 @@ Consider:
|
||||||
auto a = area(height, 2); // if the input is -2 a becomes 4294967292
|
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`.
|
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
|
##### Example
|
||||||
|
|
||||||
|
@ -11959,15 +11959,19 @@ To enable better error detection.
|
||||||
|
|
||||||
vector<int> vec {1, 2, 3, 4, 5};
|
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 (int i=0; i < vec.size(); i+=2) // mix int and unsigned
|
||||||
for (unsigned i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // risk wraparound
|
cout << vec[i] << '\n';
|
||||||
for (vector<int>::size_type i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // verbose
|
for (unsigned i=0; i < vec.size(); i+=2) // risk wraparound
|
||||||
for (auto i=0; i<vec.size(); i+=2) cout << vec[i] << '\n'; // mix int and unsigned
|
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
|
##### Note
|
||||||
|
|
||||||
The built-in array uses signed subscripts.
|
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.
|
Thus, no perfect and fully compatible solution is possible.
|
||||||
Given the known problems with unsigned and signed/unsigned mixtures, better stick to (signed) integers.
|
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) { /* ... */ }
|
catch (exception& e) { /* ... */ }
|
||||||
|
|
||||||
of - typically better stil - a `const` reference:
|
of - typically better still - a `const` reference:
|
||||||
|
|
||||||
catch (const exception& e) { /* ... */ }
|
catch (const exception& e) { /* ... */ }
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
'
|
'
|
||||||
|
10'000
|
||||||
0xFF0000
|
0xFF0000
|
||||||
0b0101'0101
|
0b0101'0101
|
||||||
10x
|
10x
|
||||||
|
@ -184,6 +185,7 @@ g1
|
||||||
g2
|
g2
|
||||||
GCC
|
GCC
|
||||||
Geosoft
|
Geosoft
|
||||||
|
getline
|
||||||
getx
|
getx
|
||||||
GFM
|
GFM
|
||||||
Girou
|
Girou
|
||||||
|
@ -205,7 +207,9 @@ hnd
|
||||||
homebrew
|
homebrew
|
||||||
HPL
|
HPL
|
||||||
href
|
href
|
||||||
|
HTTP
|
||||||
Hyslop
|
Hyslop
|
||||||
|
i2
|
||||||
IDE
|
IDE
|
||||||
IDEs
|
IDEs
|
||||||
IEC
|
IEC
|
||||||
|
@ -480,6 +484,7 @@ stmt
|
||||||
str
|
str
|
||||||
strdup
|
strdup
|
||||||
strlen
|
strlen
|
||||||
|
Str15
|
||||||
Stroustrup
|
Stroustrup
|
||||||
Stroustrup00
|
Stroustrup00
|
||||||
Stroustrup05
|
Stroustrup05
|
||||||
|
@ -527,6 +532,8 @@ typeid
|
||||||
typename
|
typename
|
||||||
typesafe
|
typesafe
|
||||||
UB
|
UB
|
||||||
|
u1
|
||||||
|
u2
|
||||||
unaliased
|
unaliased
|
||||||
uncompromised
|
uncompromised
|
||||||
underuse
|
underuse
|
||||||
|
|
Loading…
Reference in New Issue
Block a user