C++ 叮当格式怎么能不';你不把if语句放在一行吗?
就像下面的代码一样,我使用clang格式自动格式化代码C++ 叮当格式怎么能不';你不把if语句放在一行吗?,c++,clang-format,C++,Clang Format,就像下面的代码一样,我使用clang格式自动格式化代码 if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1] || fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0) { *beatsCont -=1; } 您需要使用ColumnLimit。博士。更多方法允许短锁单行?这是您可能的重复:您还可以在代码块之前使用//clan
if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]
|| fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0)
{
*beatsCont -=1;
}
您需要使用
ColumnLimit
。博士。更多方法允许短锁单行
?这是您可能的重复:您还可以在代码块之前使用//clangformat off
命令,然后在代码块之后使用//clangformat on
,这将排除您的块被clang
格式化。因此,您可以自己对其进行格式化,并将其从自动格式化中排除。这是您可能的重复(第二个答案):@FirstStep allowshortblocksonasigleline不起作用,如果每个if语句的注释方式太冗长,我将继续查找解决方案ColumnLimit
是一个全局属性。它不能阻止短的手动包装行合并,并保持长的行不变。
if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1] || fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0)
{
*beatsCont -=1;
}
AccessModifierOffset : -4
AllowAllParametersOfDeclarationOnNextLine : false
AlignEscapedNewlinesLeft : false
AlignOperands: true
AlignTrailingComments : true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine : true
AllowShortLoopsOnASingleLine: true
BinPackArguments : false
BinPackParameters : false
BreakBeforeBraces : Linux
ColumnLimit: 0
CommentPragmas: '^ *\/\/'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
IndentWidth : 4
KeepEmptyLinesAtTheStartOfBlocks : false
Language : Cpp
MaxEmptyLinesToKeep : 2
ObjCBlockIndentWidth : 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList : false
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators : true
SpaceBeforeParens : ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments : 1
SpacesInAngles: false
SpacesInContainerLiterals : false
SpacesInParentheses : false
SpacesInSquareBrackets: false
Standard: Cpp11
UseTab : Never