LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "Adrian Bunk" <bunk@stusta.de>
Cc: "Randy Dunlap" <randy.dunlap@oracle.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>, "Andi Kleen" <ak@suse.de>,
	"Trent Waddington" <trent.waddington@gmail.com>,
	"Bartlomiej Zolnierkiewicz" <bzolnier@gmail.com>,
	"Alan Cox" <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH][1/5][resend] floppy.c: Initial (partial) CodingStyle cleanup
Date: Mon, 19 Mar 2007 23:25:08 +0100	[thread overview]
Message-ID: <9a8748490703191525o1e80b3e5gdd088726df7715ec@mail.gmail.com> (raw)
In-Reply-To: <20070319202008.GY752@stusta.de>

On 19/03/07, Adrian Bunk <bunk@stusta.de> wrote:
> On Mon, Mar 19, 2007 at 07:18:38PM +0100, Jesper Juhl wrote:
> >...
> > The second reason is that indenting two tabs seems to make the most sense for
> > a few reasons;
> >       a) not indenting at all is ugly, plain and simple.
> >               void function(int a, int b,
> >               int c, int d, int e)
> >               {
> >                       int foo;
> >                       int bar;
> >               ...
> >               }
> >       b) indenting only one tab stop puts parameters at the same indent level as
> >          variables in the function which is potentially confusing (at least IMHO).
> >               void function(int a, int b,
> >                       int c, int d, int e)
> >               {
> >                       int foo;
> >                       int bar;
> >               ...
> >               }
> >       c) Indenting so that all parameter lines start at the opening paranthesis
> >          rarely matches up with tabs so you have to use varying amounts of spaces
> >          depending on how long the function name is. Not a good solution IMHO.
> >               void function(int a, int b,
> >                                    int c, int d, int e)
> >...
>
> Your example is wrong, it's:
>
>                void function(int a, int b,
>                              int c, int d, int e)
>
Hmm, thanks, when I wrote it in kmail it looked right. two tabs and
then spaces to make it line up with the starting '('.

>
> This is the most common convention in the kernel - and except for
> extremely long function names it's the one with the best readability.
>
It may be the most common, but I don't agree that it has the best
readability - but I guess that's very much a subjective thing.

> Yes, it's a problem with extremely long function names, but they are
> rare in the kernel.
>
> And the "varying amounts of spaces" should be handled automatically by
> your editor.
>

My editor may handle it initially when writing the code, but then it
gets changed and not updated or spaces and tabs end up getting mixed -
like "<tab><tab><space><tab><space>" or something else - it easily
turns into a mess.

Simply using two tabs makes it easy to see that it's not variables in
the function body and is an easy and simple convention to follow (and
IMHO also very readable).

But I guess we'll have to agree to disagree on this.
In any case, thank you for your input.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

      reply	other threads:[~2007-03-19 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 15:10 Jesper Juhl
2007-03-19 15:31 ` Randy Dunlap
2007-03-19 18:18   ` Jesper Juhl
2007-03-19 20:20     ` Adrian Bunk
2007-03-19 22:25       ` Jesper Juhl [this message]

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=9a8748490703191525o1e80b3e5gdd088726df7715ec@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bunk@stusta.de \
    --cc=bzolnier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=trent.waddington@gmail.com \
    --subject='Re: [PATCH][1/5][resend] floppy.c: Initial (partial) CodingStyle cleanup' \
    /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

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).