All of lore.kernel.org
 help / color / mirror / Atom feed
* CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples
@ 2007-10-04  9:44 Pavel Machek
  2007-10-04  9:51 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2007-10-04  9:44 UTC (permalink / raw)
  To: Andrew Morton, kernel list


Mention whitespace and bitfields style, prefer (!foo) to (foo == NULL)
in examples.

Signed-off-by: Pavel Machek <pavel@suse.cz>

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 7f1730f..1595a45 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -71,6 +71,15 @@ used for indentation, and the above exam
 
 Get a decent editor and don't leave whitespace at the end of lines.
 
+Bitfield variables should be indented like this:
+
+	unsigned int foo :1;
+
+Do not put whitespace between any of the unary operators and their operand.
+
+It is usually unnecessary to have whitespace around parentheses as
+part of expressions, around brackets, or around the operators . and
+->.
 
 		Chapter 2: Breaking long lines and strings
 
@@ -403,7 +412,7 @@ int fun(int a)
 	int result = 0;
 	char *buffer = kmalloc(SIZE);
 
-	if (buffer == NULL)
+	if (!buffer)
 		return -ENOMEM;
 
 	if (condition1) {

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples
  2007-10-04  9:44 CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples Pavel Machek
@ 2007-10-04  9:51 ` Jan Engelhardt
  2007-10-04 10:19   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2007-10-04  9:51 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Andrew Morton, kernel list


On Oct 4 2007 11:44, Pavel Machek wrote:
>diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
>index 7f1730f..1595a45 100644
>--- a/Documentation/CodingStyle
>+++ b/Documentation/CodingStyle
>@@ -71,6 +71,15 @@ used for indentation, and the above exam
> 
> Get a decent editor and don't leave whitespace at the end of lines.
> 
>+Bitfield variables should be indented like this:
>+
>+	unsigned int foo :1;

Current code uses foo:1.

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

* Re: CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples
  2007-10-04  9:51 ` Jan Engelhardt
@ 2007-10-04 10:19   ` Pavel Machek
  2007-10-06 12:40     ` Stefan Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2007-10-04 10:19 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Andrew Morton, kernel list

On Thu 2007-10-04 11:51:35, Jan Engelhardt wrote:
> 
> On Oct 4 2007 11:44, Pavel Machek wrote:
> >diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> >index 7f1730f..1595a45 100644
> >--- a/Documentation/CodingStyle
> >+++ b/Documentation/CodingStyle
> >@@ -71,6 +71,15 @@ used for indentation, and the above exam
> > 
> > Get a decent editor and don't leave whitespace at the end of lines.
> > 
> >+Bitfield variables should be indented like this:
> >+
> >+	unsigned int foo :1;
> 
> Current code uses foo:1.

I'm fine with foo :1 or foo:1. It just would be nice to have example
specifying one way...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples
  2007-10-04 10:19   ` Pavel Machek
@ 2007-10-06 12:40     ` Stefan Richter
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Richter @ 2007-10-06 12:40 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Jan Engelhardt, Andrew Morton, kernel list

Pavel Machek wrote:
> It just would be nice to have example specifying one way...

I don't see a necessity.
-- 
Stefan Richter
-=====-=-=== =-=- --==-
http://arcgraph.de/sr/

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

end of thread, other threads:[~2007-10-06 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-04  9:44 CodingStyle: mention bitfields/whitespace style, prefer (!foo) in examples Pavel Machek
2007-10-04  9:51 ` Jan Engelhardt
2007-10-04 10:19   ` Pavel Machek
2007-10-06 12:40     ` Stefan Richter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.