summaryrefslogtreecommitdiffstats
path: root/doc/coding-style.txt
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2010-12-03 11:05:28 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-12-03 14:48:41 +0200
commitdc8e2b474a8eefc5ce34a13a69d16b98ac96217b (patch)
treee8e6853780233d444188065d36fdbf99771be026 /doc/coding-style.txt
parent4da88364951bc03a076ee93e1db23648c10e0b34 (diff)
downloadofono-dc8e2b474a8eefc5ce34a13a69d16b98ac96217b.tar.bz2
coding-style M14: parenthesis around sizeof arg
Diffstat (limited to 'doc/coding-style.txt')
-rw-r--r--doc/coding-style.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 9dfdc09c..9d7131de 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -230,6 +230,20 @@ array = g_try_new0(int, 20);
if (array == NULL) // Correct
return;
+
+M14: Always use parenthesis with sizeof
+=======================================
+The expression argument to the sizeof operator should always be in
+parenthesis, too.
+
+Example:
+1)
+memset(stuff, 0, sizeof(*stuff));
+
+2)
+memset(stuff, 0, sizeof *stuff); // Wrong
+
+
O1: Shorten the name
====================
Better to use abbreviation, rather than full name, to name a variable,