From 57a62b8f6b5f6e1dad33002b69b444ddf7e56fea Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 10 Dec 2017 15:26:36 -0700 Subject: [PATCH] Add notes on using clang-format for style --- 03-Style.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/03-Style.md b/03-Style.md index 519ada3..bc9f545 100644 --- a/03-Style.md +++ b/03-Style.md @@ -9,6 +9,22 @@ C++ allows for arbitrary-length identifier names, so there's no reason to be ter are common examples. *snake_case* has the advantage that it can also work with spell checkers, if desired. +## Establishing A Style Guideline + +Whatever style guidelines you establish, be sure to implement a `.clang-format` file that specifies the style you expect. While this cannot help with naming, it is particularly important for an open source project to maintain a consistent style. + +Every IDE and many editors have support for clang-format built in or easily installable with an add-in. + + * VSCode https://marketplace.visualstudio.com/items?itemName=xaver.clang-format + * VisualStudio https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat#review-details + * Resharper++: https://www.jetbrains.com/help/resharper/2017.2/Using_Clang_Format.html + * Vim + * https://github.com/rhysd/vim-clang-format + * https://github.com/chiel92/vim-autoformat + * XCode: https://github.com/travisjeffery/ClangFormat-Xcode + + + ## Common C++ Naming Conventions * Types start with upper case: `MyClass`.