[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] HACKING: add a section on preprocessor conventions



* HACKING: Document recently-discussed style issues.

Signed-off-by: Eric Blake <eblake redhat com>
---

Turn recent discussions:
https://www.redhat.com/archives/libvir-list/2010-March/msg00058.html
https://www.redhat.com/archives/libvir-list/2010-March/msg00120.html

into policy, so I don't keep debating style points ;)

Can wait till after 0.7.7 (particularly since the vararg macro
series is also waiting).

 HACKING |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index be8725d..50b24ee 100644
--- a/HACKING
+++ b/HACKING
@@ -102,6 +102,17 @@ Usually they're in macro definitions or strings, and should be converted
 anyhow.


+Preprocessor
+============
+For variadic macros, stick with C99 syntax:
+
+#define vshPrint(_ctl, ...)   fprintf(stdout, __VA_ARGS__)
+
+Use parenthesis when checking if a macro is defined:
+
+#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
+
+
 C types
 =======
 Use the right type.
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]