[tor-commits] [tor/master] Document some operators usage conventions.

nickm at torproject.org nickm at torproject.org
Tue Aug 1 14:50:55 UTC 2017

commit 18115b5aa94d6242a75c2587cd0ff126704026a7
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Aug 1 10:50:52 2017 -0400

    Document some operators usage conventions.
 doc/HACKING/CodingStandards.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/doc/HACKING/CodingStandards.md b/doc/HACKING/CodingStandards.md
index 2599c3ec6..55c23a7df 100644
--- a/doc/HACKING/CodingStandards.md
+++ b/doc/HACKING/CodingStandards.md
@@ -175,6 +175,19 @@ old C functions.  Use `strlcat`, `strlcpy`, or `tor_snprintf/tor_asprintf` inste
 We don't call `memcmp()` directly.  Use `fast_memeq()`, `fast_memneq()`,
 `tor_memeq()`, or `tor_memneq()` for most purposes.
+Also see a longer list of functions to avoid in:
+Other C conventions
+The `a ? b : c` trinary operator only goes inside other expressions;
+don't use it as a replacement for if. (You can ignore this inside macro
+definitions when necessary.)
+Assignment operators shouldn't nest inside other expressions.  (You can
+ignore this inside macro definitions when necessary.)
 Functions not to write

More information about the tor-commits mailing list