Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的代码中有一些注释:
//asdf
当我在其上使用 clang-format 时,它会在 // 字符之后添加一个空格:
// asdf
如何防止在 clang-format 配置中发生这种情况?
谢谢
结合这两个问题的答案应该可以解决问题:
所以文件中的以下行.clang-format应该可以解决问题(我没有测试它):
.clang-format
CommentPragmas: '^[^ ]'
这告诉 clang-format 不要混淆以空格以外的内容开头的注释。
为完整起见,请参阅此处的 clang 格式文档。