chore: 补充编码规范——文件内私有函数用匿名 namespace

- CODEBUDDY.md 新增「编码规范」章节:只在一个 cpp 内使用的函数
  放在该文件的匿名 namespace{} 中,不用文件级 static
- CoreTools.cpp 的 MakeTempSatPath 按新规范改为匿名 namespace
This commit is contained in:
company-desktop-computer committed 2026-10-21 09:18:09 +08:00
1 parent b8ef6ceb2c
commit 27cd7111fb
2 files changed
+14 -1

No files matched your search

+10
View File
@@ -144,6 +144,16 @@ set_debug_post_build(<target> "<Name>" ".arx")
- 改完自检:`python -c "print(open('f.cpp','rb').read(3))"` 应为 `b'\xef\xbb\xbf'`;再查 `raw.count(b'\xef\xbf\xbd')`,非 0 说明中文已被写坏(不可逆),用 `git checkout HEAD -- <file>` 还原重做。
- 若遇到仍是 GBK/UTF-16 的老文件(从旧分支检出),先探明编码再改,不要假设。
## 编码规范
- **文件内私有函数用匿名 `namespace`**:只在一个 `.cpp` 内使用的函数,直接实现在该文件的匿名 `namespace { }` 中,不要写成文件级 `static`,也不要放进头文件。
```cpp
namespace {
CString MakeTempSatPath() { ... }
}
```
## 测试 / 静态检查
本仓库**没有单元测试框架**(无 gtest/Catch2),也没有 lint 配置。验证方式是编译对应 preset,并在 CAD 中加载 `.arx` / `.zrx` 实测。