Subject: Re: coding style question on indentation

From: Ben Hutchings <[email-masked]>
Date: Fri, 01 Jul 2011 12:52:38 +0100

On Fri, 2011-07-01 at 04:20 -0700, [email-masked] 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.