Coder Social home page Coder Social logo

Comments (6)

MaJerle avatar MaJerle commented on June 25, 2024

Many IDE and editors use clang-format to format code, like VSCode, Clion, Visual Studio, QtCreator.

clang-format style docs: https://clang.llvm.org/docs/ClangFormatStyleOptions.html

BasedOnStyle: GNU may help

Can you make a pull request?

from c-code-style.

Logiase avatar Logiase commented on June 25, 2024
---
Language: Cpp
BasedOnStyle: GNU
IndentWidth: 4
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: None
BreakBeforeBraces: Custom
SpaceBeforeParens: ControlStatements
BraceWrapping:
  AfterFunction: false

This may help, just put it to your project root and rename to .clang-format, and format code, most editors will use it.

I use template.c and template.h, it works fine, but it need more tests.

from c-code-style.

MaJerle avatar MaJerle commented on June 25, 2024

I came up with this so far.

Do you know how to align macro definitions to certain column?

---
Language: Cpp
BasedOnStyle: GNU
IndentWidth: 4
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: None
SpaceBeforeParens: ControlStatements
BreakBeforeBraces: Custom
BraceWrapping:
  AfterFunction: false
  AfterCaseLabel: false
  AfterEnum: false
  AfterControlStatement: Never
  AfterStruct : false
  AfterUnion : false
  AfterExternBlock : false
  BeforeElse : false
  BeforeWhile : false
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignEscapedNewlines: Right
AlignOperands: Align
AllowShortBlocksOnASingleLine: Empty
AllowShortEnumsOnASingleLine: False
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine : false
AlwaysBreakAfterReturnType: AllDefinitions
AlignTrailingComments : true
AlignConsecutiveMacros: AcrossEmptyLines
InsertBraces : true
KeepEmptyLinesAtTheStartOfBlocks : false
PointerAlignment : Left
QualifierAlignment : Left
ReferenceAlignment : Left
RemoveBracesLLVM : false
SpaceAfterCStyleCast : false
SpaceAfterLogicalNot : false
SpaceAfterTemplateKeyword : false
SpaceAroundPointerQualifiers : Before
SpaceBeforeAssignmentOperators : true
SpaceBeforeCaseColon : false
SpaceBeforeCpp11BracedList : false
SpaceBeforeParens : ControlStatements
SpaceBeforeParensOptions :
  AfterControlStatements : true
  AfterFunctionDeclarationName : false
  AfterFunctionDefinitionName : false
  AfterOverloadedOperator : false
SpaceBeforeRangeBasedForLoopColon : false
SpaceBeforeSquareBrackets : false
SpaceInEmptyBlock : false
SpaceInEmptyParentheses : false
SpacesInCStyleCastParentheses : false
SpacesInConditionalStatement : false
SpacesInContainerLiterals : false
SpacesInParentheses: false
SpacesInSquareBrackets : false
UseTab : Never

BitFieldColonSpacing: None
BreakBeforeBinaryOperators: true

from c-code-style.

negativeExponent avatar negativeExponent commented on June 25, 2024

if it helps, ive also found this site when i was testing for clang-format configurations:

https://zed0.co.uk/clang-format-configurator/
source: https://github.com/zed0/clang-format-configurator

from c-code-style.

EmbeddedLife615 avatar EmbeddedLife615 commented on June 25, 2024

from c-code-style.

EmbeddedLife615 avatar EmbeddedLife615 commented on June 25, 2024

from c-code-style.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.