[Spice-devel] [PATCH v4 02/12] Added External References section

Christophe de Dinechin christophe at dinechin.org
Thu Feb 15 16:06:15 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

Changes since v3:
- Clarify that the guidelines are an objective, not the state of the code
- Clarify that we try to have a unique style between C and C++
- Clarify that existing practice and code consistency matter

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 docs/spice_style.txt | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index c8a4cff6..7bb3e1fc 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -6,6 +6,40 @@ Licensed under a Creative Commons Attribution-Share Alike 3.0
 United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode).
 
 
+External references
+-------------------
+
+In general, unless otherwise noted here (e.g. the use of tabs) or obvious from existing usage
+in the code base,
+
+- For C code, SPICE follows the Linux kernel coding conventions as documented here:
+  https://www.kernel.org/doc/html/v4.10/process/coding-style.html.
+  Notable deviations from the Linux coding style include:
+  + The use of 4 spaces for indentation instead of tabs
+  + The use of typedefs for structs not considered as a mistake
+  + The use of CamelCase for struct and class names
+
+- For C++ code, SPICE follows the LLVM coding standard (https://llvm.org/docs/CodingStandards.html).
+  Notable deviations from the LLVM coding style include:
+  + The format of header comments
+  + The placement of braces after functions and classes (follows the Linux style)
+
+In addition, for C++, developers should be aware of the C++ Core
+Guidelines and consider them as best practice unless otherwise agreed
+on by the team
+https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
+
+We are trying to keep our C and C++ styles consistent with one
+another. For example, we prefer methods with snake_names instead of
+CamelCase, because that's the SPICE C style for functions. Similarly,
+we prefer CamelCase for classes because that's the SPICE C style for structs.
+
+This style guide only indicates what we aim to achieve. It does not
+necessarily reflect the current state of the code. Consistency matters.
+It may be preferable to ignore a guideline documented here if it helps
+keeping the modified code consistent with its environment.
+
+
 Source Files
 ------------
 
-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list