现象
由于 C/Cpp 的格式化程序是共用的,使用如下语句对 C 语言程序进行 Cpp 兼容
#ifdef __cplusplus
extern "C"
{
#endif
......
#ifdef __cplusplus
}
#endif
会导致 { } 间的代码被胡乱初始化,缩进量乱七八糟
线索
需要将 .clang-format 文件中的 IndentExternBlock 条目改为 NoIndent ,针对性解决
由于 C/Cpp 的格式化程序是共用的,使用如下语句对 C 语言程序进行 Cpp 兼容
#ifdef __cplusplus
extern "C"
{
#endif
......
#ifdef __cplusplus
}
#endif
会导致 { } 间的代码被胡乱初始化,缩进量乱七八糟
需要将 .clang-format 文件中的 IndentExternBlock 条目改为 NoIndent ,针对性解决