0
아래의 코드는, 나는clang-format은 if 문을 한 줄에 어떻게 넣지 않을 수 있습니까?
나는 .clang-formt 파일을 설정 무엇이든if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]
|| fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0)
{
*beatsCont -=1;
}
, 그것은 항상이 같은 형식 내 코드 자동 형식으로 연타 포맷을 사용하는 것처럼 :
if(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1] || fabs(detectBeats[*beatsCont-2] > detectBeats[*beatsCont-1]) < 1.0)
{
*beatsCont -=1;
}
어떻게 if 문을 온라인으로 래핑하지 않는 규칙을 설정 했습니까?
내 질문은 그 질문 (Clang format splits if statement body into multiple lines) 내 문을 포장하는 경우가 아닌 몸/c를 여기
내 .clang 형식의 파일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
'AllowShortBlocksOnASingleLine'? 여기에 가능한 복제본이 있습니다 : [** Clang 형식은 문장 본문을 여러 줄로 나눕니다 **] (http://stackoverflow.com/questions/22512344/clang-format-splits-if-statement-body-into-multiple- lines) –
또한 코드 블럭 이전에'/ clang-format off' 명령을 사용하고, 블럭 뒤에'clang-format on'을 사용할 수 있습니다. 그러면'clang'에 의해 포맷 된 블럭을 제외 할 것입니다. 따라서 사용자가 직접 형식을 지정하고 자동화 된 형식 지정에서 제외하십시오. 여기에 가능한 중복 (두 번째 대답)입니다 : [** lang-format line breaks **] (http://stackoverflow.com/questions/33656800/clang-format-line-breaks) –
@ FirstStep AllowShortBlocksOnASingleLine은 작동하지 않습니다. , 모든 if 문에 대한 comments-way가 너무 길면 솔루션을 계속 살펴볼 것입니다. – user392412