Update CONTRIBUTING.md
Make brace position more explicit in both .cpp & .h.
This commit is contained in:
parent
47481c76e8
commit
010ce6f0f1
|
@ -55,17 +55,22 @@ In short: The easier the code review is, the better the chance your pull request
|
||||||
|
|
||||||
* ###### Good:
|
* ###### Good:
|
||||||
```cpp
|
```cpp
|
||||||
if ()
|
void MyClass::method1()
|
||||||
|
{
|
||||||
|
if (aCondition)
|
||||||
{
|
{
|
||||||
// Do something
|
// Do something
|
||||||
}
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* ###### Bad:
|
* ###### Bad:
|
||||||
```cpp
|
```cpp
|
||||||
if () {
|
void MyClass::method1() {
|
||||||
|
if (aCondition) {
|
||||||
// Do something
|
// Do something
|
||||||
}
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
However, the method definition could be defined in a header file (.h), if there's one line code only. In this case, Java-like braces should be used.
|
However, the method definition could be defined in a header file (.h), if there's one line code only. In this case, Java-like braces should be used.
|
||||||
* ###### Good:
|
* ###### Good:
|
||||||
|
@ -76,7 +81,8 @@ In short: The easier the code review is, the better the chance your pull request
|
||||||
void method1();
|
void method1();
|
||||||
int method2() {
|
int method2() {
|
||||||
return _x; // only one line code can be placed in .h as method definition
|
return _x; // only one line code can be placed in .h as method definition
|
||||||
}
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _x;
|
int _x;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue