mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alistair John Strachan <s0348365@sms.ed.ac.uk>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: lkml <linux-kernel@vger.kernel.org>, akpm <akpm@osdl.org>,
	jesper.juhl@gmail.com
Subject: Re: [PATCH/RFC] CodingStyle updates
Date: Thu, 7 Dec 2006 22:54:51 +0000	[thread overview]
Message-ID: <200612072254.51348.s0348365@sms.ed.ac.uk> (raw)
In-Reply-To: <20061207004838.4d84842c.randy.dunlap@oracle.com>

Hi Randy,

On Thursday 07 December 2006 08:48, Randy Dunlap wrote:
[snip]
> +		3.1:  Spaces
> +
> +Linux kernel style for use of spaces depends (mostly) on
> +function-versus-keyword usage.  Use a space after (most) keywords.
> +The notable exception is "sizeof", which looks like a function
> +(and is usually used with parentheses in Linux, although they are
> +not required in the language, as in: "sizeof struct file").
> +So use a space after these keywords:
> +	if, switch, case, for, do, while
> +but not with "sizeof".  E.g.,
> +	s = sizeof(struct file);
> +
> +Do not add spaces around (inside) parenthesized expressions.
> +This example is *bad*:
> +
> +	s = sizeof( struct file );
> +
> +When declaring pointer data or a function that returns a pointer type,
> +the preferred use of '*' is adjacent to the data name or function name
> +and not adjacent to the type name.  Examples:
> +
> +	char *linux_banner;
> +	unsigned long long memparse(char *ptr, char **retptr);
> +	char *match_strdup(substring_t *s);
> +
> +Use one space around (on each side of) most binary operators, such as
> +any of these:
> +		=  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=
> +
> +but no space after unary operators:
> +		sizeof  ++  --  &  *  +  -  ~  !  defined

You could mention typeof too, which is a keyword but should be done like 
sizeof.

-- 
Cheers,
Alistair.

Final year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.

  parent reply	other threads:[~2006-12-07 22:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07  8:48 Randy Dunlap
2006-12-07  8:54 ` Jesper Juhl
2006-12-07 11:11 ` Jan Engelhardt
2006-12-07 16:01   ` Chris Friesen
2006-12-07 18:27     ` Jan Engelhardt
2006-12-07 21:36       ` Randy Dunlap
2006-12-07 21:36   ` Randy Dunlap
2006-12-07 22:54 ` Alistair John Strachan [this message]
2006-12-07 23:00   ` Randy Dunlap
2006-12-07 23:06     ` David Miller
2006-12-07 23:15       ` Randy Dunlap
2006-12-07 23:23     ` Jan Engelhardt
2006-12-14 22:38 ` David Weinehall
2006-12-14 22:42   ` Randy Dunlap
2006-12-15  0:07     ` Robert P. J. Day
2006-12-15  0:26       ` Randy Dunlap
2006-12-15  0:44         ` Robert P. J. Day
2006-12-14 23:33 ` Scott Preece
2006-12-14 23:43   ` Randy Dunlap
2006-12-14 23:54     ` Scott Preece

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=200612072254.51348.s0348365@sms.ed.ac.uk \
    --to=s0348365@sms.ed.ac.uk \
    --cc=akpm@osdl.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    /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

all inboxes | Powered by JetHome®