newbies CheckpatchTips for multiline statements (Breaking function calls)

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

 



http://kernelnewbies.org/CheckpatchTips

The block about "Breaking function calls" is dubious.

The majority of code today uses arguments aligned to parenthesis.
The suggested 1 tab is in fact very infrequently used.

CodingStyle has this as "substantially to the right", not 1 tab.

btw: there's a perferred/preferred tyop too.

------------

Breaking function calls

Sometimes a call to a function has several variables, and you need to
break the line in the middle of those variables. Look at this example: 

 
        pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN, GFP_KERNEL, &pdata->urb->transfer_dma);


This line is too long, so we want to break it up. By default, vim will
increase the indentation of the trailing line by one tab: 

        pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
                GFP_KERNEL, &pdata->urb->transfer_dma);


This style is fine, and generally perferred. However, some driver
writers prefer to have the trailing line of a function call line up with
the starting '('. They use tabs, followed by spaces, to align the
trailing line: 

 
        pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
                                            GFP_KERNEL,
                                            &pdata->urb->transfer_dma);


Again, the one tab indent style is preferred, but don't change lines
that use the other style. 



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux