Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH] coding-style M14: parenthesis around sizeof arg
@ 2010-12-03  9:05 Pekka.Pessi
  2010-12-03 12:59 ` Aki Niemi
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka.Pessi @ 2010-12-03  9:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 doc/coding-style.txt |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 9dfdc09..9d7131d 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,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] coding-style M14: parenthesis around sizeof arg
  2010-12-03  9:05 [PATCH] coding-style M14: parenthesis around sizeof arg Pekka.Pessi
@ 2010-12-03 12:59 ` Aki Niemi
  0 siblings, 0 replies; 2+ messages in thread
From: Aki Niemi @ 2010-12-03 12:59 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

On Fri, 2010-12-03 at 11:05 +0200, ext Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
> 
> ---
>  doc/coding-style.txt |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)

Pushed, thanks.

Cheers,
Aki


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-03 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-03  9:05 [PATCH] coding-style M14: parenthesis around sizeof arg Pekka.Pessi
2010-12-03 12:59 ` Aki Niemi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox