aboutsummaryrefslogtreecommitdiff
path: root/doc/HACKING/CodingStandards.md
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-08-01 10:50:52 -0400
committerNick Mathewson <nickm@torproject.org>2017-08-01 10:50:52 -0400
commit18115b5aa94d6242a75c2587cd0ff126704026a7 (patch)
tree01ecc6d23f97be2fdbb2d8922910a92e122b8c52 /doc/HACKING/CodingStandards.md
parenta374fa7285327a8cad33037e3c983bd14906a112 (diff)
downloadtor-18115b5aa94d6242a75c2587cd0ff126704026a7.tar.gz
tor-18115b5aa94d6242a75c2587cd0ff126704026a7.zip
Document some operators usage conventions.
Diffstat (limited to 'doc/HACKING/CodingStandards.md')
-rw-r--r--doc/HACKING/CodingStandards.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/HACKING/CodingStandards.md b/doc/HACKING/CodingStandards.md
index 2599c3ec69..55c23a7df5 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:
+https://people.torproject.org/~nickm/tor-auto/internal/this-not-that.html
+
+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
----------------------