lkml.org 
[lkml]   [2006]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH/RFC] CodingStyle updates
    Date
    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@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-12-07 23:57    [W:0.026 / U:0.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site