From a2dba2e78b826f53ee85b34e6d4962b756682cdf Mon Sep 17 00:00:00 2001 From: Jacob Langley Date: Mon, 13 Feb 2017 13:14:42 -0800 Subject: [PATCH] Fix cpplint issues Rconc-create0.cpp:20: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Res-always5.cpp:15: Missing space after , [whitespace/comma] [3] Rp-lib0.cpp:15: Missing space after , [whitespace/comma] [3] Rs-using-directive0.cpp:25: Extra space after ( in function call [whitespace/parens] [4] Rs-using-directive0.cpp:25: Extra space before ) [whitespace/parens] [2] --- CppCoreGuidelines.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index eab67ce..71ef50b 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1067,7 +1067,7 @@ So, if a suitable library exists for your application domain, use it. ##### Example - std::sort(begin(v),end(v),std::greater<>()); + std::sort(begin(v), end(v), std::greater<>()); Unless you are an expert in sorting algorithms and have plenty of time, this is more likely to be correct and to run faster than anything you write for a specific application. @@ -9105,7 +9105,7 @@ Readability. Minimize resource retention. Note: C++17 also adds `if` and `switch` initializer statements. These require C++17 support. - map mymap; + map mymap; if (auto result = mymap.insert(value); result.second) { // insert succeeded, and result is valid for this block @@ -9508,7 +9508,7 @@ Assuming that there is a logical connection between `i` and `j`, that connection Obviously, what we really would like is a construct that initialized n variables from a `tuple`. For example: - auto [i,j] = make_related_widgets(cond); // C++17, not C++14 + auto [i, j] = make_related_widgets(cond); // C++17, not C++14 Today, we might approximate that using `tie()`: @@ -12494,8 +12494,7 @@ Thread creation is expensive. // process } - void - (istream& is) + void master(istream& is) { for (Message m; is >> m; ) run_list.push_back(new thread(worker, m)); @@ -16574,10 +16573,10 @@ Doing so takes away an `#include`r's ability to effectively disambiguate and to // user.cpp #include "bad.h" - bool copy( /*... some parameters ...*/); // some function that happens to be named copy + bool copy(/*... some parameters ...*/); // some function that happens to be named copy int main() { - copy( /*...*/ ); // now overloads local ::copy and std::copy, could be ambiguous + copy(/*...*/); // now overloads local ::copy and std::copy, could be ambiguous } ##### Enforcement