Update CONTRIBUTING.md

Define the braces position in C++ header files.
This commit is contained in:
Don HO 2022-02-17 13:50:48 +01:00 committed by GitHub
parent 2df765e189
commit 47481c76e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -67,7 +67,20 @@ In short: The easier the code review is, the better the chance your pull request
// 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.
* ###### Good:
```cpp
class MyClass
{
public:
void method1();
int method2() {
return _x; // only one line code can be placed in .h as method definition
}
private:
int _x;
}
```
2. ##### Use tabs instead of white-spaces (we usually set our editors to 4 white-spaces for 1 tab, but the choice is up to you). 2. ##### Use tabs instead of white-spaces (we usually set our editors to 4 white-spaces for 1 tab, but the choice is up to you).