File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
+ # https://clang.llvm.org/docs/ClangFormatStyleOptions.html
2
3
# We base things of WebKit + Allman braces
3
4
# BasedOnStyle: WebKit
5
+ AccessModifierOffset : -4
6
+ AllowShortFunctionsOnASingleLine : None
4
7
BreakBeforeBraces : Allman
5
8
BreakConstructorInitializers : BeforeComma
9
+ # This is not the ACTUAL column limit, this is just to make
10
+ # clang-format chill out! Use your best judgement!
11
+ ColumnLimit : 160
6
12
CompactNamespaces : ' false'
7
13
ConstructorInitializerIndentWidth : 0
8
14
Cpp11BracedListStyle : ' false'
Original file line number Diff line number Diff line change @@ -64,6 +64,41 @@ Here are the points from `.clang-format` explained:
64
64
65
65
When in doubt, defaulting to ` WebKit style with Allman braces ` is _ seemingly_ a safe option.
66
66
67
+ ` AccessModifierOffset: -4 `
68
+ ``` cpp
69
+ // Correct ✔️
70
+ class Classname
71
+ {
72
+ public:
73
+ Classname();
74
+
75
+ private:
76
+ int member;
77
+ }
78
+
79
+ // Wrong ❌
80
+ class Classname
81
+ {
82
+ public:
83
+ Classname ();
84
+
85
+ private:
86
+ int member;
87
+ }
88
+ ```
89
+
90
+ `AllowShortFunctionsOnASingleLine: Empty`
91
+ ```cpp
92
+ // Correct ✔️
93
+ void f()
94
+ {
95
+ foo();
96
+ }
97
+
98
+ // Wrong ❌
99
+ void f() { foo(); }
100
+ ```
101
+
67
102
` BreakBeforeBraces: Allman `
68
103
69
104
Braces should _ almost always_ be on a new line.
255
290
256
291
### C++ Misc & Naming
257
292
258
- `Casting - static_cast over C-Style`
293
+ `Casting - static_cast over C-Style (cppcoreguidelines-pro-type-cstyle-cast) `
259
294
```cpp
260
295
// Correct ✔️
261
296
uint32 param = static_cast<uint32>(input);
You can’t perform that action at this time.
0 commit comments