File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -3681,12 +3681,12 @@ ID_nameTooShort     :bulb: global suggestion
3681
3681
示例:
3682
3682
```
3683
3683
// 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
3687
3687
3688
3688
int foo(int i) {
3689
- return i + i; // Confusing
3689
+ return i + i; // Confusing
3690
3690
}
3691
3691
```
3692
3692
名称适用的作用域范围越广,其长度也应该越长,建议全局名称长度不小于 3 个字符。
@@ -3818,7 +3818,7 @@ using namespace std; // Non-compliant
3818
3818
```
3819
3819
下例展示的问题是头文件不同的包含顺序竟导致同一函数产生了不同的行为:
3820
3820
```
3821
- // a.h
3821
+ // In a.h
3822
3822
void foo(char);
3823
3823
3824
3824
namespace ns {
@@ -3829,19 +3829,19 @@ inline void bar() {
3829
3829
foo(0);
3830
3830
}
3831
3831
3832
- // b.h
3832
+ // In b.h
3833
3833
namespace ns {}
3834
3834
using namespace ns;
3835
3835
3836
- // a.cpp
3836
+ // In a.cpp
3837
3837
#include "a.h"
3838
3838
#include "b.h"
3839
3839
3840
3840
void fun1() {
3841
3841
bar(); // ‘bar’ calls ‘foo(char)’
3842
3842
}
3843
3843
3844
- // b.cpp
3844
+ // In b.cpp
3845
3845
#include "b.h"
3846
3846
#include "a.h"
3847
3847
You can’t perform that action at this time.
0 commit comments