Last active
August 5, 2021 06:38
-
-
Save sergev/b2d1fc5edf7c240bcbd87d3e43ea916f to your computer and use it in GitHub Desktop.
My preferred C++ code formatting style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
BasedOnStyle: Google | |
# | |
# Indent by four columns. | |
# | |
IndentWidth: 4 | |
# | |
# Limit source width by 100 columns. | |
# | |
ColumnLimit: 100 | |
# | |
# The brace breaking style: | |
# attach braces to surrounding context, but break before functions. | |
# | |
BreakBeforeBraces: WebKit | |
# | |
# For case labels, use the same indentation level as for the switch statement. | |
# | |
IndentCaseLabels: false | |
# | |
# For access modifiers (like public:), | |
# use the same indentation level as the class statement. | |
# | |
AccessModifierOffset: -4 | |
# | |
# Align pointers to the right, like: int *a; | |
# | |
DerivePointerAlignment: false | |
PointerAlignment: Right | |
# | |
# Short functions, loops or ifs should be split into multiple lines. | |
# | |
AllowShortFunctionsOnASingleLine: InlineOnly | |
AllowShortIfStatementsOnASingleLine: Never | |
AllowShortLoopsOnASingleLine: false | |
# | |
# Break inheritance list and constructor initializers before colon. | |
# | |
BreakInheritanceList: BeforeColon | |
BreakConstructorInitializers: BeforeColon | |
ConstructorInitializerAllOnOneLineOrOnePerLine: false | |
# | |
# Align trailing comments. | |
# | |
AlignTrailingComments: true | |
SpacesBeforeTrailingComments: 1 | |
# | |
# Put function definition’s parameters either all on the same line or one line each. | |
# | |
BinPackParameters: false | |
AllowAllParametersOfDeclarationOnNextLine: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment