From: Randy Dunlap <rdunlap@xenotime.net>
To: Jim Cromie <jim.cromie@gmail.com>
Cc: Linux kernel <linux-kernel@vger.kernel.org>,
Randy Dunlap <rdunlap@xenotime.net>,
davem@davemloft.net
Subject: Re: Coding style on function signatures (was: Convert tasklets to work queues )
Date: Sat, 7 Jul 2007 21:37:53 -0700 [thread overview]
Message-ID: <20070707213753.7480ccca.rdunlap@xenotime.net> (raw)
In-Reply-To: <46903483.3020205@gmail.com>
On Sat, 07 Jul 2007 18:49:07 -0600 Jim Cromie wrote:
> Linus Torvalds wrote:
> >
> >
> > Yes, code should be less than 80 characters wide.
> >
> > But hey, sometimes it's just more readable to have one line that is
> > slightly longer than it should be, than to split something that is awkward
> > to split.
> >
> >
> < cc-list heavily trimmed >
>
>
> could you speak to the specific case of function signatures ?
> I saw nothing in CodingStyle specifically about this.
> (I skimmed, and grepped for signature)
>
> forex:
>
> static ssize_t
> store_fan_div (struct device *dev, struct device_attribute *devattr,
> const char *buf, size_t count)
> {...}
>
>
> IIRC, many like the entire sig on one line, because its grep friendly.
> I personally like the above, but grep-ability is hard to argue against.
(I expect that "you" above means Linus, but anyway...)
Some people like the above so that the function name can be grepped
using a "^store_fan_div" regex, but that's not good enough reason
for it for others, including Linus, IIRC. We have other tools
to find where functions are.
> The above has 2 violations (of strict-grep-ability rule)
> 1 - return sig is separate
> 2 - arg-list is split
#2 can't be helped unless someone is willing to go way beyond the
80-or-so column limit.
I would write that function sig like so:
static ssize_t store_fan_div(struct device *dev,
struct device_attribute *devattr,
const char *buf, size_t count)
Some people would add spaces on lines 2 & 3 so that all of the
function parameters are aligned. I don't care very much one way
or the other about that.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
next prev parent reply other threads:[~2007-07-08 4:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-22 18:20 [RFC PATCH 0/5 v2] Convert all tasklets to workqueues V2 Steven Rostedt
2007-06-22 18:20 ` [RFC PATCH 1/5 v2] Convert the RCU tasklet into a softirq Steven Rostedt
2007-06-22 22:53 ` Paul E. McKenney
2007-06-22 18:20 ` [RFC PATCH 2/5 v2] Split out tasklets from softirq.c Steven Rostedt
2007-06-22 18:20 ` [RFC PATCH 3/5 v2] Add a tasklet is-scheduled API Steven Rostedt
2007-06-22 18:20 ` [RFC PATCH 4/5 v2] Make DRM use the tasklet is-sched API Steven Rostedt
2007-06-22 18:20 ` [RFC PATCH 5/5 v2] Convert tasklets to work queues Steven Rostedt
2007-06-23 16:53 ` Andrew Morton
2007-06-23 18:00 ` Steven Rostedt
2007-06-23 18:19 ` Linus Torvalds
2007-06-23 18:52 ` Randy Dunlap
2007-06-23 18:58 ` Andrew Morton
2007-06-23 19:18 ` Linus Torvalds
2007-07-08 0:49 ` Coding style on function signatures (was: Convert tasklets to work queues ) Jim Cromie
2007-07-08 4:37 ` Randy Dunlap [this message]
2007-07-08 6:02 ` Oleg Verych
2007-07-08 10:12 ` Jan Engelhardt
2007-06-23 19:27 ` [RFC PATCH 5/5 v2] Convert tasklets to work queues Steven Rostedt
2007-06-23 19:39 ` Andrew Morton
2007-06-23 22:09 ` Linus Torvalds
2007-06-28 6:57 ` Jeff Garzik
2007-06-23 17:17 ` Oleg Nesterov
2007-06-23 21:15 ` [RFC PATCH 0/5 v2] Convert all tasklets to workqueues V2 Ed Tomlinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070707213753.7480ccca.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=davem@davemloft.net \
--cc=jim.cromie@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).