Skip to content

Commit 97ddff8

Browse files
authored
精炼辞句
1 parent d70e27d commit 97ddff8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

c-cpp-rules.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,12 +3681,12 @@ ID_nameTooShort     :bulb: global suggestion
36813681
示例:
36823682
```
36833683
// In global scope
3684-
const int i = 0; // Non-compliant, name too short
3685-
typedef int t; // Non-compliant, name too short
3686-
class A { .... }; // Non-compliant, name too short
3684+
const int i = 0; // Non-compliant, name too short
3685+
typedef int t; // Non-compliant, name too short
3686+
class A { .... }; // Non-compliant, name too short
36873687
36883688
int foo(int i) {
3689-
return i + i; // Confusing
3689+
return i + i; // Confusing
36903690
}
36913691
```
36923692
名称适用的作用域范围越广,其长度也应该越长,建议全局名称长度不小于 3 个字符。
@@ -3818,7 +3818,7 @@ using namespace std; // Non-compliant
38183818
```
38193819
下例展示的问题是头文件不同的包含顺序竟导致同一函数产生了不同的行为:
38203820
```
3821-
// a.h
3821+
// In a.h
38223822
void foo(char);
38233823
38243824
namespace ns {
@@ -3829,19 +3829,19 @@ inline void bar() {
38293829
foo(0);
38303830
}
38313831
3832-
// b.h
3832+
// In b.h
38333833
namespace ns {}
38343834
using namespace ns;
38353835
3836-
// a.cpp
3836+
// In a.cpp
38373837
#include "a.h"
38383838
#include "b.h"
38393839
38403840
void fun1() {
38413841
bar(); // ‘bar’ calls ‘foo(char)’
38423842
}
38433843
3844-
// b.cpp
3844+
// In b.cpp
38453845
#include "b.h"
38463846
#include "a.h"
38473847

0 commit comments

Comments
 (0)