Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Joe Perches
On Mon, 2014-12-15 at 14:59 +0300, Dan Carpenter wrote: > I prefer !foo because it is more common in the kernel and I think it's > easier to read but I don't feel strongly about this. Me too. But I do prefer consistency. fyi: for variants of: "if (!foo)" vs "if (foo == NULL)"

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Jeremiah Mahler
Dan, On Mon, Dec 15, 2014 at 04:43:34PM +0300, Dan Carpenter wrote: > On Mon, Dec 15, 2014 at 05:03:46AM -0800, Jeremiah Mahler wrote: > > > > Or another way mentioned in K that produces a compile error > > > > if (NULL = x) > > > > Yes. People used to write Yoda code back in

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Dan Carpenter
On Mon, Dec 15, 2014 at 05:03:46AM -0800, Jeremiah Mahler wrote: > > Or another way mentioned in K that produces a compile error > > if (NULL = x) > Yes. People used to write Yoda code back in the day. Don't ever do this in the kernel. 1) It looks stupid. 2) GCC will catch most

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Jeremiah Mahler
On Mon, Dec 15, 2014 at 11:44:21AM +, One Thousand Gnomes wrote: > On Sat, 13 Dec 2014 11:46:47 -0800 > Jeremiah Mahler wrote: > > > Loïc, > > > > On Sat, Dec 13, 2014 at 07:22:38PM +0100, Loic Pefferkorn wrote: > > > > Whose convention is this? I can't find any mention in > > > >

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Dan Carpenter
I haven't seen any bugs caused by lack of type safety with "!foo"... I prefer !foo because it is more common in the kernel and I think it's easier to read but I don't feel strongly about this. I kind of hate "if (foo != NULL) though, because it's a double negative. But I really hate when people

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread One Thousand Gnomes
On Sat, 13 Dec 2014 11:46:47 -0800 Jeremiah Mahler wrote: > Loïc, > > On Sat, Dec 13, 2014 at 07:22:38PM +0100, Loic Pefferkorn wrote: > > > Whose convention is this? I can't find any mention in > > > Documention/CodingStyle. checkpatch.pl doesn't complain about them. > > > And there are

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread One Thousand Gnomes
On Sat, 13 Dec 2014 11:46:47 -0800 Jeremiah Mahler jmmah...@gmail.com wrote: Loïc, On Sat, Dec 13, 2014 at 07:22:38PM +0100, Loic Pefferkorn wrote: Whose convention is this? I can't find any mention in Documention/CodingStyle. checkpatch.pl doesn't complain about them. And there are

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Dan Carpenter
I haven't seen any bugs caused by lack of type safety with !foo... I prefer !foo because it is more common in the kernel and I think it's easier to read but I don't feel strongly about this. I kind of hate if (foo != NULL) though, because it's a double negative. But I really hate when people

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Jeremiah Mahler
On Mon, Dec 15, 2014 at 11:44:21AM +, One Thousand Gnomes wrote: On Sat, 13 Dec 2014 11:46:47 -0800 Jeremiah Mahler jmmah...@gmail.com wrote: Loïc, On Sat, Dec 13, 2014 at 07:22:38PM +0100, Loic Pefferkorn wrote: Whose convention is this? I can't find any mention in

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Dan Carpenter
On Mon, Dec 15, 2014 at 05:03:46AM -0800, Jeremiah Mahler wrote: Or another way mentioned in KR that produces a compile error if (NULL = x) Yes. People used to write Yoda code back in the day. Don't ever do this in the kernel. 1) It looks stupid. 2) GCC will catch most ==

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Jeremiah Mahler
Dan, On Mon, Dec 15, 2014 at 04:43:34PM +0300, Dan Carpenter wrote: On Mon, Dec 15, 2014 at 05:03:46AM -0800, Jeremiah Mahler wrote: Or another way mentioned in KR that produces a compile error if (NULL = x) Yes. People used to write Yoda code back in the day.

Re: [PATCH] checkpatch giving bogus advice (was staging: goldfish: Fix minor coding style)

2014-12-15 Thread Joe Perches
On Mon, 2014-12-15 at 14:59 +0300, Dan Carpenter wrote: I prefer !foo because it is more common in the kernel and I think it's easier to read but I don't feel strongly about this. Me too. But I do prefer consistency. fyi: for variants of: if (!foo) vs if (foo == NULL) a