From adf3543a5703d56c1afdb9b5ebb4eb9ff039229d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 27 Jul 2014 06:19:25 -0400 Subject: [PATCH 1/2] Fix a style guide oversight Fixes an oversight which says to not use mult-line comments. --- Contributing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Contributing.md b/Contributing.md index af2025ce4a..c7e18c8dd0 100644 --- a/Contributing.md +++ b/Contributing.md @@ -34,6 +34,7 @@ Following this guide and formatting your code as detailed will likely get your p - The opening brace for namespaces, classes, functions, enums, structs, unions, conditionals, and loops go on the next line. - With array initializer lists and lambda expressions it is OK to keep the brace on the same line. - References and pointers have the ampersand or asterisk against the type name, not the variable name. Example: `int* var`, not `int *var`. +- Don't use multi-line comments (`/* Comment text */`), use single-line comments (`// Comment text`) instead. - Don't collapse single line conditional or loop bodies onto the same line as its header. Put it on the next line. - Yes: From 2791f6053e9558653c6fac3753ce8ae64d2a84f0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 27 Jul 2014 07:45:34 -0400 Subject: [PATCH 2/2] Clarify the preferred prefix form to be within loops in the style guide --- Contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contributing.md b/Contributing.md index c7e18c8dd0..5bcbdb65b1 100644 --- a/Contributing.md +++ b/Contributing.md @@ -139,7 +139,7 @@ private: - Try to avoid using raw pointers (pointers allocated with `new`) as much as possible. There are cases where using a raw pointer is unavoidable, and in these situations it is OK to use them. An example of this is functions from a C library that require them. In cases where it is avoidable, the STL usually has a means to solve this (`vector`, `unique_ptr`, etc). - Do not use the `auto` keyword everywhere. While it's nice that the type can be determined by the compiler, it cannot be resolved at 'readtime' by the developer as easily. Use auto only in cases where it is obvious what the type being assigned is (note: 'obvious' means not having to open other files or reading the header file). Some situations where it is appropriate to use `auto` is when iterating over a `std::map` container in a foreach loop, or to shorten the length of container iterator variable declarations. - Do not use `using namespace [x];` in headers. Try not to use it at all if you can. -- The preferred form of the increment and decrement operator is prefix (e.g. `++var`). +- The preferred form of the increment and decrement operator in for-loops is prefix-form (e.g. `++var`). ### Headers - If a header is not necessary in a certain source file, remove them.