[Spice-commits] docs/spice_style.txt

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Feb 8 14:27:36 UTC 2018

 docs/spice_style.txt |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

New commits:
commit 5088afb05a63d1e4b087b631278a64fecfcd5cd6
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Feb 6 22:28:23 2018 +0000

    style: Update style to include some C++ element
    This style is used by other SPICE projects like spice-streaming-agent.
    See discussion "Coding style and naming conventions for C++" at
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Lukáš Hrázký <lhrazky at redhat.com>

diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index f5d13642..6fdba48c 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -380,3 +380,55 @@ Also in source (no header) files you must include `config.h` at the beginning so
 #include "spice_server.h"
+C\++ style follows C style if not specified otherwise.
+The C+\+11 dialect is assumed by default. No attempts will be made to
+restrict the code to older variants of C+\+.
+For compatibility reasons don't use more recent C++ dialects.
+Method names
+Method names should use lower case and separate words with
+Namespaces should use lower case and separate words with underscores.
+Namespace blocks should not increase indentation.
+Namespaces can be nested. Namespace closing brackets for nested
+namespaces can be placed together on the same line, but for
+readability reasons the closure should specify the namespace with a
+namespace spice {
+namespace streaming_agent {
+class ClassInsideNamespace {
+}} // namespace spice::streaming_agent
+The `using namespace` construct should never be used in headers. It should
+be used sparingly in source files, and only within the body of short
+Preferred alternatives to `using namespace` include:
+* using declarations
+using spice::streaming_agent::some_class;
+* namespace aliases
+namespace ssa = spice::streaming_agent;

More information about the Spice-commits mailing list