projects
/
platform
/
upstream
/
ofono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4da8836
)
coding-style M14: parenthesis around sizeof arg
author
Pekka Pessi
<Pekka.Pessi@nokia.com>
Fri, 3 Dec 2010 09:05:28 +0000
(11:05 +0200)
committer
Aki Niemi
<aki.niemi@nokia.com>
Fri, 3 Dec 2010 12:48:41 +0000
(14:48 +0200)
doc/coding-style.txt
patch
|
blob
|
history
diff --git
a/doc/coding-style.txt
b/doc/coding-style.txt
index
9dfdc09
..
9d7131d
100644
(file)
--- 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,