Skip to content

Commit 798bbd6

Browse files
committed
3.25 的翻译
1 parent 7dd86d0 commit 798bbd6

File tree

13 files changed

+122
-322
lines changed

13 files changed

+122
-322
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
- { key: readability-identifier-naming.VariableCase, value: lower_case }
7373
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
7474
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
75-
...
75+
...

advice.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,24 @@
1212
*`UPPER_CASE`
1313
* 全局常量 `UPPER_CASE`
1414
* 如果和关键字冲突 (e.g., `namespace`),就连接一个下划线 (e.g., `namespace_`)。
15+
16+
## 单位
17+
18+
内部角度运算用弧度制。显式存储的角度常量用角度制。无后缀的类型采用国际单位。
19+
20+
```cpp
21+
const double SOME_ANGLE = math::deg_to_rad(45); // 角度制转弧度制
22+
const double SIN_RESULT = std::sin(SOME_ANGLE);
23+
```
24+
25+
## 不省略 if / for statements 的花括号
26+
27+
```cpp
28+
// use
29+
if (true) {
30+
continue;
31+
}
32+
// not
33+
if (true)
34+
continue;
35+
```

example.jpg

-1.21 MB
Binary file not shown.

example.png

3.93 MB
Loading

examples/1

16.7 KB
Binary file not shown.

examples/cpp_example.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class AStrangeTypeName {
3838
int member2;
3939
};
4040

41+
int new_func(int a, int b, int c) {
42+
return 2;
43+
}
44+
4145
struct Foo {
4246
float a;
4347
float b;
@@ -58,7 +62,6 @@ int main() {
5862
foo.b = 2;
5963
}
6064

61-
auto lambda_exp = []() { return 2; };
62-
65+
Foo f = Foo { 1, 2, 3 };
6366
return foo.a;
6467
}

examples/event_loop/event_loop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ IntVector EventLoop::really_long_function_name(
4040
assert(false);
4141
}
4242
}
43-
return {num_entries};
43+
return { num_entries };
4444
}
4545

4646
} // namespace my_namespace

examples/event_loop/event_loop.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// Author: void_ccc
22
/// This is ...
3-
#ifndef EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP_
4-
#define EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP_
3+
#ifndef EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP
4+
#define EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP
55

66
#include <vector>
77

@@ -42,4 +42,4 @@ class EventLoop: public CallbackInterface {
4242

4343
} // namespace my_namespace
4444

45-
#endif // EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP_
45+
#endif // EXAMPLES_EVENT_LOOP_EVENT_LOOP_HPP

0 commit comments

Comments
 (0)