[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200612072254.51348.s0348365@sms.ed.ac.uk>
Date: Thu, 7 Dec 2006 22:54:51 +0000
From: Alistair John Strachan <s0348365@....ed.ac.uk>
To: Randy Dunlap <randy.dunlap@...cle.com>
Cc: lkml <linux-kernel@...r.kernel.org>, akpm <akpm@...l.org>,
jesper.juhl@...il.com
Subject: Re: [PATCH/RFC] CodingStyle updates
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.
-
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