All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Sathya.Perla@Emulex.Com
Cc: netdev@vger.kernel.org
Subject: Re: coding style question on indentation
Date: Fri, 01 Jul 2011 12:52:38 +0100	[thread overview]
Message-ID: <1309521158.3093.1670.camel@localhost> (raw)
In-Reply-To: <3367B80B08154D42A3B2BC708B5D41F63F87EF145E@EXMAIL.ad.emulex.com>

On Fri, 2011-07-01 at 04:20 -0700, Sathya.Perla@Emulex.Com wrote:
> Hi,
> Which of the following styling is preferable when a function
> invocation spans more than one line:
> 
> a) Aligning the next line with the first argument by inserting a few
> spaces after the tabs - as in:
> 
> 	dma_unmap_page(&adapter->pdev->dev,
> 			   dma_unmap_addr(rx_page_info, bus),
> 			   adapter->big_page_size, DMA_FROM_DEVICE);

My preference, for what it's worth.

> Documentation/CodingStyle says "spaces are never used for indentation", but I see
> scripts/Lindent inserting spaces after tabs for alignment.

I think that's meant to apply to indentation at the start of a statement
or declaration, not when wrapping.

> OR
> 
> b) Just using tabs without needing to align as above:
> 
> 	dma_unmap_page(&adapter->pdev->dev,
> 			dma_unmap_addr(rx_page_info, bus),
> 			adapter->big_page_size, DMA_FROM_DEVICE);

Popular but ugly in my opinion.

Some people also use a single extra tab to indent after wrapping,
whether or not the line break is within a parenthesised expression or
argument list.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2011-07-01 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01 11:20 coding style question on indentation Sathya.Perla
2011-07-01 11:52 ` Ben Hutchings [this message]
2011-07-01 15:23 ` Joe Perches
2011-07-05 19:54   ` Chris Friesen
2011-07-05 20:01     ` Joe Perches

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=1309521158.3093.1670.camel@localhost \
    --to=bhutchings@solarflare.com \
    --cc=Sathya.Perla@Emulex.Com \
    --cc=netdev@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.