[PATCH docs 3/3] contributing: Add style for C++

OpenBMC Patches openbmc-patches at stwcx.xyz
Thu Jul 21 08:30:16 AEST 2016


From: Patrick Williams <patrick at stwcx.xyz>

Signed-off-by: Patrick Williams <patrick at stwcx.xyz>
---
 contributing.md | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/contributing.md b/contributing.md
index 5d64b32..070f63c 100644
--- a/contributing.md
+++ b/contributing.md
@@ -71,6 +71,29 @@ This style can mostly be verified with 'astyle' as follows:
 
     astyle --style=linux --indent=tab=8 --indent=force-tab=8
 
+### C++
+
+Being an extensive and complicated language, there are often differences of
+opinions on "good" and "bad" C++ code.  The following are the approaches
+favored within the OpenBMC projects:
+
+  1. Favor syntax and techniques from the latest available C++ standard,
+     currently C++14.
+  2. Rely on well-recognized opinions on best practices:
+       1. C++ Core Guidelines - https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
+       2. Effective Modern C++ - http://www.aristeia.com/books.html
+  3. Give preference to style decisions from the Google C++ Style Guide -
+     https://google.github.io/styleguide/cppguide.html
+
+In order to meet the chosen style for C++ code, files should pass through
+'astyle' unchanged when called as follows:
+
+    astyle --style=allman --add-brackets --convert-tabs --max-code-length=80 \
+        --indent=spaces=4 --indent-classes --indent-switches --indent-labels \
+        --indent-preproc-define --min-conditional-indent=0 --pad-oper \
+        --pad-header --unpad-paren --break-after-logical \
+        --align-pointer=type --align-reference=type
+
 Submitting changes
 ------------------
 
-- 
2.9.0




More information about the openbmc mailing list