lkml.org 
[lkml]   [2009]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH RFC] Codingstyle: allow omitting braces for all single statement branches
    From
    Date
    On Thu, 2009-11-26 at 10:26 +0100, Uwe Kleine-König wrote:

    > -This does not apply if one branch of a conditional statement is a single
    > -statement. Use braces in both branches.
    > -
    > -if (condition) {
    > - do_this();
    > - do_that();
    > -} else {
    > - otherwise();
    > -}
    > +If not all branches of a conditional statement are single statements you might
    > +use braces for both branches.
    > +
    > + if (condition) {
    > + do_this();
    > + do_that();
    > + } else
    > + otherwise();
    > +
    > +or
    > +
    > + if (condition) {
    > + do_this();
    > + do_that();
    > + } else {
    > + otherwise();
    > + }
    >
    > 3.1: Spaces

    Andrew recently objected to this pattern, and I tend to agree with him
    although I might be guilty of a few such cases myself.

    --
    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: 2009-11-26 15:55    [W:5.254 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site