Files
playbook/docs/cpp/naming.md
T
csh e504a689dc 📝 docs(playbook): add contributing and multi-language standards
Introduce C++ and Python docs/templates and split .agents rulesets by language (tsl/cpp/python).

Move commit message guidance to CONTRIBUTING.md (full spec remains in docs/common/commit_message.md).
2025-12-14 17:32:50 +08:00

32 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# C++ 命名规范(Naming
本章节以 Google C++ Style Guide 为基线,并补充模块化(Modules)相关的命名约定。
## 1. 总原则
- 一致性优先:以仓库现有风格为准,标准用于“无上下文/新代码”的默认选择。
- 名字体现作用域与语义,不用 `tmp/data/info` 这类弱语义词。
## 2. 命名风格总览(默认)
- 类型(class/struct/enum/using):`PascalCase`
- 函数/方法:`PascalCase`
- 变量:`lower_snake_case`
- 成员变量:`lower_snake_case_`(尾随下划线,Google
- 常量:`kPascalCase`(编译期/全局固定值)
- 命名空间:`lowercase``lower_snake_case`(按项目约定,建议全仓统一)
## 3. 文件命名
- 文件名:`lower_snake_case`(与 Google 风格一致)
- 头文件:`foo_bar.h`
- 源文件:`foo_bar.cc`
- Module 文件:`foo_bar.cppm`
## 4. Modules 命名
- Module 名使用点分层级:`<root>.<subsystem>.<component>`
- 每一段建议用 `lower_snake_case`
- 示例:`my_project.market.data_feed`
- 文件路径建议与 module 名可映射(便于检索与定位)。