Re: checkpatch guide for newbies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 23, 2013 at 02:46:38PM +0200, Peter Senna Tschudin wrote:
> > It's preferred if the operator goes at the end of the first line instead of at
> > the start of the second line:
> > Bad:
> > -       PowerData = (1 << 31) | (0 << 30) | (24 << 24)
> > -                   | BitReverse(w89rf242_txvga_data[i][0], 24);
> > Good:
> > +       PowerData = (1 << 31) | (0 << 30) | (24 << 24) |
> > +                   BitReverse(w89rf242_txvga_data[i][0], 24);
> What is the rule for where to start the second line here?
> 

The if statement alignment has become a rule and people will make you
redo it if it's not aligned.  I haven't seen anyone have to redo a
patch because of alignment on these:

My favorite format is aligned:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
	      yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Also popular:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
		yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Right aligned looks like nonsense:
	foo = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
					yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;

Here is a more complex aligned statement:
	foo = bar * (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
		     yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy);

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux