LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: 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>,
	jesper.juhl@gmail.com
Subject: Re: [PATCH][1/5][resend] floppy.c: Initial (partial) CodingStyle cleanup
Date: Mon, 19 Mar 2007 19:18:38 +0100	[thread overview]
Message-ID: <200703191918.39277.jesper.juhl@gmail.com> (raw)
In-Reply-To: <20070319083159.0744cf5e.randy.dunlap@oracle.com>

On Monday 19 March 2007 16:31:59 Randy Dunlap wrote:
> On Mon, 19 Mar 2007 16:10:13 +0100 Jesper Juhl wrote:
> >     This is a basic CodingStyle cleanup for drivers/block/floppy.c
[snip]
> >
> > -#define LAST_OUT(x) if (output_byte(x)<0){ reset_fdc();return;}
> > +#define LAST_OUT(x) if (output_byte(x) < 0) { reset_fdc(); return; }
>
> Not for a coding style cleanup, but that macro is Bad according to
> CodingStyle, so hopefully it will be cleaned up in the future.
>
Looking at each of the (many) macros in there is on my TODO list, but fixing 
macros was not the point of this patch.

[snip]
> > @@ -3816,7 +3803,7 @@ static int check_floppy_change(struct gendisk
> > *disk) */
> >
> >  static int floppy_rb0_complete(struct bio *bio, unsigned int bytes_done,
> > -			       int err)
> > +		int err)
>
> I don't care one way or the other about most of these, but would
> you explain that one above (and others like it), please?

Sure.

> It's not an < 80 columns thing.  My <cough> recollection is that
> many indented function parameters in Linux are indented more like
> the original here, near the opening '(' after the function name,
> although I suppose that none of this is in CodingStyle.
>

The reason behind the change is manyfold.

The first reason is consistency. Function parameters that span over more than 
one line should be indented identical for each such function in the file (and 
preferably across files as well).  The changes made by this patch make all 
such functions the same within floppy.c

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)
		{
			int foo;
			int bar;
		...
		}
	d) Indenting by two tab stops avoids the problems with a, b & c and also
	   avoids indenting so much so that the number of lines needed (when all
	   need to be kept <80 col) is not increased too much in most cases. 
		void function(int a, int b,
				int c, int d, int e)
		{
			int foo;
			int bar;
		...
		}

I also have a recollection (although I can't find the exact threads atm) that 
in the past the question of how to indent function parameters that span more 
than one line, settled on two tabs.

I hope that explains my reasons for making the change :-)

This should probably go into CodingStyle if some official consensus on this 
can be reached. 


-- 
 Jesper Juhl <jesper.juhl@gmail.com>

 
 

  reply	other threads:[~2007-03-19 18:18 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 [this message]
2007-03-19 20:20     ` Adrian Bunk
2007-03-19 22:25       ` Jesper Juhl

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=200703191918.39277.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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).