[Top][All Lists]

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

[lmi-commits] [lmi] master a9228d2: Add a "Preprocessor Conditions" styl

From: Vadim Zeitlin
Subject: [lmi-commits] [lmi] master a9228d2: Add a "Preprocessor Conditions" style item
Date: Sun, 11 Mar 2018 17:11:55 -0400 (EDT)

branch: master
commit a9228d23a6ed7b36177c7ccc49729afd881d870f
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Add a "Preprocessor Conditions" style item
    Document that `#if defined` should be preferred to `#ifdef`.
 vz/Style-guide.md | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vz/Style-guide.md b/vz/Style-guide.md
index 01b81eb..a61ff4f 100644
--- a/vz/Style-guide.md
+++ b/vz/Style-guide.md
@@ -156,6 +156,17 @@ Rationale: This makes it impossible to use an 
uninitialized field and avoids
 duplication of the same values among different constructors.
+Preprocessor Conditions
+### Prefer `#if defined FOO` to `#ifdef FOO`
+Similarly, use `#if !defined FOO` rather than `#ifndef Foo`.
+Also write the comment after `#else` (if any) or `#endif` as `// defined FOO`
+for symmetry (rather than just `// FOO` which would match `#if FOO`).
 Special Member Functions

reply via email to

[Prev in Thread] Current Thread [Next in Thread]