hacking: add a section on preprocessor conventions

* doc/hacking.html.in (preprocessor): New section to document
recently-discussed style issues.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake
2010-03-08 17:02:45 -07:00
committed by Jim Meyering
parent 0be3783316
commit 095375925e
2 changed files with 34 additions and 1 deletions

14
HACKING
View File

@@ -102,6 +102,20 @@ 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, and use
indentation to track nesting:
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
#endif
C types
=======
Use the right type.