Just like the code below, I use clang-format to automatic format my codes

if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]
   || fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0){
    *beatsCont -=1;}

Whatever I set the .clang-formt file, it always formatted like this:

if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1] ||
fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0){
    *beatsCont -=1;}

How can I set the rules not wrap the if statements into oneline?

Here is my .clang-format file

AccessModifierOffset : -4AllowAllParametersOfDeclarationOnNextLine :
falseAlignEscapedNewlinesLeft : falseAlignOperands:
trueAlignTrailingComments : trueAllowShortCaseLabelsOnASingleLine:
trueAllowShortFunctionsOnASingleLine:
falseAllowShortIfStatementsOnASingleLine :
trueAllowShortLoopsOnASingleLine: trueBinPackArguments :
falseBinPackParameters : falseBreakBeforeBraces : LinuxColumnLimit:
0CommentPragmas: '^
*\/\/'ConstructorInitializerAllOnOneLineOrOnePerLine:
falseConstructorInitializerIndentWidth: 4ContinuationIndentWidth:
4Cpp11BracedListStyle: trueIndentWidth :
4KeepEmptyLinesAtTheStartOfBlocks : falseLanguage :
CppMaxEmptyLinesToKeep : 2ObjCBlockIndentWidth :
2ObjCSpaceAfterProperty: trueObjCSpaceBeforeProtocolList :
falsePointerAlignment: RightReflowComments:  trueSortIncludes:
trueSpaceAfterCStyleCast: falseSpaceBeforeAssignmentOperators :
trueSpaceBeforeParens : ControlStatementsSpaceInEmptyParentheses:
falseSpacesBeforeTrailingComments : 1SpacesInAngles:
falseSpacesInContainerLiterals : falseSpacesInParentheses :
falseSpacesInSquareBrackets: falseStandard: Cpp11UseTab : Never
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to