[libvirt] [PATCH] docs: mention C89 syntax preferences

Eric Blake eblake at redhat.com
Wed Mar 30 17:27:11 UTC 2011


* docs/hacking.html.in (Code formatting): Document that // comment
and declaration-after-statement are discouraged.
* HACKING: Regenerate.
---

Any comments on the wording chosen here?  Should this go in for 0.9.0?

 HACKING              |    6 ++++++
 docs/hacking.html.in |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index b2ceaa7..686328c 100644
--- a/HACKING
+++ b/HACKING
@@ -127,6 +127,12 @@ Note that sometimes you'll have to post-process that output further, by piping
 it through "expand -i", since some leading TABs can get through. Usually
 they're in macro definitions or strings, and should be converted anyhow.

+Libvirt requires a C99 compiler for various reasons. However, most of the code
+base prefers to stick to C89 syntax unless there is a compelling reason
+otherwise. For example, it is preferable to use "/* */" comments rather than
+"//". Also, when declaring local variables, the prevailing style has been to
+declare them at the beginning of a scope, rather than immediately before use.
+

 Curly braces
 ============
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index e0484dd..dd8eeb8 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -152,6 +152,16 @@
       anyhow.
     </p>

+    <p>
+      Libvirt requires a C99 compiler for various reasons.  However,
+      most of the code base prefers to stick to C89 syntax unless
+      there is a compelling reason otherwise.  For example, it is
+      preferable to use <code>/* */</code> comments rather
+      than <code>//</code>.  Also, when declaring local variables, the
+      prevailing style has been to declare them at the beginning of a
+      scope, rather than immediately before use.
+    </p>
+

     <h2><a name="curly_braces">Curly braces</a></h2>

-- 
1.7.4




More information about the libvir-list mailing list