Update CONTRIBUTING.md
This commit is contained in:
parent
b4c53b1e59
commit
01013689b8
|
@ -67,13 +67,13 @@ enum SomeEnum {
|
||||||
* Note that the asterisks are indented by one space to align to the first line.
|
* Note that the asterisks are indented by one space to align to the first line.
|
||||||
*/
|
*/
|
||||||
struct Position {
|
struct Position {
|
||||||
int x, y;
|
int x{}, y{}; // Always intitialize member variables!
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use "typename" rather than "class" here
|
// Use "typename" rather than "class" here
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void FooBar() {
|
void FooBar() {
|
||||||
std::string some_string{ "prefer uniform initialization" };
|
const std::string some_string{ "prefer uniform initialization" };
|
||||||
|
|
||||||
int some_array[]{
|
int some_array[]{
|
||||||
5,
|
5,
|
||||||
|
@ -89,7 +89,7 @@ void FooBar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place a single space after the for loop semicolons, prefer pre-increment
|
// Place a single space after the for loop semicolons, prefer pre-increment
|
||||||
for (int i = 0; i != 25; ++i) {
|
for (int i{}; i != 25; ++i) {
|
||||||
// This is how we write loops
|
// This is how we write loops
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void FooBar() {
|
||||||
switch (var) {
|
switch (var) {
|
||||||
// No indentation for case label
|
// No indentation for case label
|
||||||
case 1: {
|
case 1: {
|
||||||
int case_var = var + 3;
|
int case_var{ var + 3 };
|
||||||
DoSomething(case_var);
|
DoSomething(case_var);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue