README.Coding: Add a boolean example we use very often
authorAndreas Schneider <asn@samba.org>
Mon, 15 Feb 2016 14:51:26 +0000 (15:51 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 15 Feb 2016 16:42:13 +0000 (17:42 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
README.Coding

index 29bad1b1ffcdd7d8ce35f6ed65805d7cb8848296..c4e9dfebf9885575b810b875c999e913548afcfd 100644 (file)
@@ -312,6 +312,17 @@ lib/replace/, new code should adhere to the following conventions:
   * Boolean values are "true" and "false" (not True or False)
   * Exact width integers are of type [u]int[8|16|32|64]_t
 
+Most of the time a good name for a boolean variable is 'ok'. Here is an
+example we often use:
+
+       bool ok;
+
+       ok = foo();
+       if (!ok) {
+               /* do something */
+       }
+
+It makes the code more readable and is easy to debug.
 
 Typedefs
 --------