[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1207091904480.25143@chino.kir.corp.google.com>
Date: Mon, 9 Jul 2012 19:21:47 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Joe Perches <joe@...ches.com>
cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, mm-commits@...r.kernel.org,
apw@...onical.com
Subject: Re: + checkpatch-add-check-for-use-of-sizeof-without-parenthesis.patch
added to -mm tree
On Mon, 9 Jul 2012, Joe Perches wrote:
> I don't really care what style a large block of code
> uses. I care that it mostly has the same form.
>
Same form?? The sizeof operator has two forms depending on whether it's a
unary expression or a type as specified by the standard.
The issue here is that you're mandating they all use the same form because
you're quoting an email from Linus four years ago that you dug up but
isn't required in the coding style and is already used in over 1000 places
in the kernel.
If you want the output of checkpatch.pl to be useful, I would think you
would want to eliminate this kind of garbage.
> > I guarantee you that those who learned from K&R don't
> > think sizeof(unsigned long) "looks like a function".
>
> Tell that to Linus. He wrote the email I referenced
> which you so apparently blithely elided.
>
> Repeating it:
>
> "Another example of this is "sizeof". The kernel universally (I hope) has
> parenthesis around the sizeof argument, even though it's clearly not
> required by the C language."
>
He's obviously addressing a single form of the sizeof operator, i.e. those
on unary expressions; sizeof used on a type CLEARLY DOES require the
parenthesis.
Anyway, since this is my last email on the matter since I've already
showed how your patch is completely busted, you're talking purely about
style preferences here. Don't convolute that by talking about the C
standard or Linus' email where he says "it's a coding standard." It's
not. I've layed out the two forms of the sizeof operator in every email
I've written in this thread. If you want to enforce a _style_ preference
because you saw an email four years ago that Linus wrote, then add it to
CodingStyle first and get him to mandate it. That's how you effect a
kernel-wide change; the _only_ person I know that uses checkpatch is
Andrew and you'll notice the mm directory is the one where "sizeof ..."
isn't used so just changing checkpatch here won't do much good.
Thanks and have a nice day.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists