Skip to content

Commit 9864022

Browse files
committed
travis CI fixes
1 parent d45496f commit 9864022

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

CppCoreGuidelines.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12698,7 +12698,7 @@ consider `gsl::finally()` as a cleaner and more reliable alternative to `goto ex
1269812698

1269912699
switch(x){
1270012700
case 1 :
12701-
while(/* some condition */){
12701+
while (/* some condition */) {
1270212702
//...
1270312703
break;
1270412704
} //Oops! break switch or break while intended?
@@ -12715,8 +12715,8 @@ Often, a loop that requires a `break` is a good candidate for a function (algori
1271512715
void use1(){
1271612716
std::vector<T> vec = {/* initialized with some values */};
1271712717
T value;
12718-
for(const T item : vec){
12719-
if(/* some condition*/){
12718+
for (const T item : vec) {
12719+
if (/* some condition*/) {
1272012720
value = item;
1272112721
break;
1272212722
}
@@ -12725,30 +12725,30 @@ Often, a loop that requires a `break` is a good candidate for a function (algori
1272512725
}
1272612726

1272712727
//BETTER: create a function and return inside loop
12728-
T search(const std::vector<T> &vec){
12729-
for(const T &item : vec){
12730-
if(/* some condition*/) return item;
12728+
T search(const std::vector<T> &vec) {
12729+
for (const T &item : vec) {
12730+
if (/* some condition*/) return item;
1273112731
}
1273212732
return T(); //default value
1273312733
}
1273412734

12735-
void use2(){
12735+
void use2() {
1273612736
std::vector<T> vec = {/* initialized with some values */};
1273712737
T value = search(vec);
1273812738
/* then do something with value */
1273912739
}
1274012740

1274112741
Often, a loop that uses `continue` can equivalently and as clearly be expressed by an `if`-statement.
1274212742

12743-
for(int item : vec){ //BAD
12744-
if(item%2 == 0) continue;
12745-
if(item == 5) continue;
12746-
if(item > 10) continue;
12743+
for (int item : vec) { //BAD
12744+
if (item%2 == 0) continue;
12745+
if (item == 5) continue;
12746+
if (item > 10) continue;
1274712747
/* do something with item */
1274812748
}
1274912749

12750-
for(int item : vec){ //GOOD
12751-
if(item%2 != 0 && item != 5 && item <= 10){
12750+
for (int item : vec) { //GOOD
12751+
if (item%2 != 0 && item != 5 && item <= 10) {
1275212752
/* do something with item */
1275312753
}
1275412754
}
@@ -14972,21 +14972,20 @@ There is no explicit locking and both correct (value) return and error (exceptio
1497214972
return value;
1497314973
}
1497414974

14975-
1497614975
void async_example()
1497714976
{
1497814977
try
1497914978
{
14980-
auto v1 = std::async(std::launch::async, read_value, "v1.txt");
14979+
auto v1 = std::async(std::launch::async, read_value, "v1.txt");
1498114980
auto v2 = std::async(std::launch::async, read_value, "v2.txt");
1498214981
std::cout << v1.get() + v2.get() << '\n';
1498314982
}
14984-
catch (std::ios_base::failure & fail)
14983+
catch (std::ios_base::failure & fail)
1498514984
{
1498614985
// handle exception here
1498714986
}
1498814987
}
14989-
14988+
1499014989
##### Note
1499114990

1499214991
Unfortunately, `async()` is not perfect.
@@ -19201,6 +19200,7 @@ to files that includes it or in scenarios where the different search algorithm i
1920119200
#include "helpers.h" // A project specific file, use "" form
1920219201

1920319202
##### Note
19203+
1920419204
Failing to follow this results in difficult to diagnose errors due to picking up the wrong file by incorrectly specifying the scope when it is included.
1920519205

1920619206
Library creators should put their headers in a folder and have clients include those files using the relative path `#include <some_library/common.h>`
@@ -20282,9 +20282,11 @@ and errors (when we didn't deal correctly with semi-constructed objects consiste
2028220282
// main problem: constructor does not fully construct
2028320283
Picture(int x, int y)
2028420284
{
20285-
mx = x; // also bad: assignment in constructor body rather than in member initializer
20285+
mx = x; // also bad: assignment in constructor body
20286+
// rather than in member initializer
2028620287
my = y;
20287-
data = nullptr; // also bad: constant initialization in constructor rather than in member initializer
20288+
data = nullptr; // also bad: constant initialization in constructor
20289+
// rather than in member initializer
2028820290
}
2028920291

2029020292
~Picture()
@@ -20466,7 +20468,7 @@ Reference sections:
2046620468
Libraries used have to have been approved for mission critical applications.
2046720469
Any similarities to this set of guidelines are unsurprising because Bjarne Stroustrup was an author of JSF++.
2046820470
Recommended, but note its very specific focus.
20469-
* [_MISRA C++ 2008: Guidelines for the use of the C++ language in critical systems_] (https://www.misra.org.uk/Buyonline/tabid/58/Default.aspx).
20471+
* [MISRA C++ 2008: Guidelines for the use of the C++ language in critical systems](https://www.misra.org.uk/Buyonline/tabid/58/Default.aspx).
2047020472
* [Mozilla Portability Guide](https://developer.mozilla.org/en-US/docs/Mozilla/C%2B%2B_Portability_Guide).
2047120473
As the name indicates, this aims for portability across many (old) compilers.
2047220474
As such, it is restrictive.

scripts/hunspell/isocpp.dic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ ASIC
5252
asio
5353
AST
5454
async
55+
AUTOSAR
5556
'B'
5657
b2
5758
BDE
@@ -320,6 +321,7 @@ Meyers96
320321
Meyers97
321322
microbenchmarks
322323
middleware
324+
MISRA
323325
mixin
324326
mixins
325327
mnemonizes
@@ -598,6 +600,7 @@ UTF
598600
util
599601
v's
600602
v1
603+
v17
601604
v2
602605
va
603606
ValueType

0 commit comments

Comments
 (0)