From 18115b5aa94d6242a75c2587cd0ff126704026a7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 1 Aug 2017 10:50:52 -0400 Subject: Document some operators usage conventions. --- doc/HACKING/CodingStandards.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'doc/HACKING/CodingStandards.md') 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 ---------------------- -- cgit v1.2.3-54-g00ecf