public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* (0 == foo), rather than (foo == 0)
@ 2004-03-10  6:16 Godbole, Amarendra (GE Consumer & Industrial)
  2004-03-10 10:34 ` Bernd Petrovitsch
  2004-03-10 18:02 ` Randy.Dunlap
  0 siblings, 2 replies; 43+ messages in thread
From: Godbole, Amarendra (GE Consumer & Industrial) @ 2004-03-10  6:16 UTC (permalink / raw)
  To: linux-kernel

Hi,

While writing code, the assignment operator (=) is many-a-times confused with the comparison operator (==) resulting in very subtle bugs difficult to track. To keep a check on this -- the constant can be written on the LHS rather than the RHS which will result in a compile time error if wrong operator is used.

Is this an encouraged practice while writing any code for the kernel ? Or is this choice left to the developer ? I was unable to find any reference to it in the CodingStyle document. I did find some code under drivers/ which used (NULL == foo) and similar constructs. 

Can this be added to the CodingStyle document ?

Cheers,
Amarendra

--
#include <std$disclaimer.h>

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

end of thread, other threads:[~2004-03-11 23:07 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-10  6:16 (0 == foo), rather than (foo == 0) Godbole, Amarendra (GE Consumer & Industrial)
2004-03-10 10:34 ` Bernd Petrovitsch
2004-03-10 18:02 ` Randy.Dunlap
2004-03-10 18:33   ` Richard B. Johnson
2004-03-10 18:50     ` [OT] " David Ford
2004-03-10 19:06       ` Roland Dreier
2004-03-10 19:26         ` David Ford
2004-03-10 21:26           ` Roland Dreier
2004-03-10 22:03             ` Måns Rullgård
2004-03-11 23:12               ` Bill Davidsen
2004-03-10 19:23       ` Richard B. Johnson
2004-03-10 19:31         ` David Ford
2004-03-10 23:20           ` Frank v Waveren
2004-03-10 23:33             ` Måns Rullgård
2004-03-11  2:14             ` David Ford
2004-03-11 15:06             ` Valdis.Kletnieks
2004-03-10 23:10         ` Peter Williams
2004-03-10 21:29       ` viro
2004-03-10 22:20         ` David Ford
2004-03-10 22:42           ` Richard B. Johnson
2004-03-11  0:33             ` Micha Feigin
2004-03-11 10:47               ` Giuseppe Bilotta
2004-03-10 22:49           ` Stefan Smietanowski
2004-03-10 23:14             ` David Ford
2004-03-10 23:28               ` Måns Rullgård
2004-03-10 23:47               ` Stefan Smietanowski
2004-03-10 21:34       ` Matthew Garrett
2004-03-10 23:00     ` Peter Williams
2004-03-11  0:16       ` Randy.Dunlap
2004-03-11  2:36       ` Linus Torvalds
2004-03-11  3:08         ` Peter Williams
2004-03-11  3:19           ` Linus Torvalds
2004-03-11  4:40             ` Stefan Smietanowski
2004-03-11  9:48               ` Måns Rullgård
2004-03-11 10:29                 ` Stefan Smietanowski
2004-03-11 15:18                 ` Andreas Schwab
2004-03-11 17:42                   ` Stefan Smietanowski
2004-03-11 23:05                     ` Bill Davidsen
2004-03-11  6:50         ` Willy Tarreau
2004-03-11  7:36           ` Peter Williams
2004-03-11 15:03     ` Valdis.Kletnieks
2004-03-11 15:22       ` Richard B. Johnson
2004-03-11 15:48         ` Valdis.Kletnieks

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