Re: [QUESTION] staging/easycap fix

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

 



2012/2/14 Ezequiel García <elezegarcia@xxxxxxxxx>:
> El día 14 de febrero de 2012 02:06, Greg KH <greg@xxxxxxxxx> escribió:
>> On Tue, Feb 14, 2012 at 01:47:52AM -0300, Ezequiel García wrote:
>>> 2. second, I am fixing some style issues (besides checkpatch), for
>>> instance "if" syntax:
>>>
>>> -   if (0 == bInterfaceNumber) {
>>> +   if (bInterfaceNumber == 0) {
>>
>> You do know why the first style was chosen, right?
>
> This driver code has this "if" style on every if clause. Perhaps
> author's taste? Don't know.
> Searching at kernel code I haven't seen this kind of "if" style.
>

This particular "if" style is recommended because it prevents the
accidental "always true if condition" in case when the coder
accidentally types "=" instead of "==". "if (0 = x)" can always save
you instead of "if (x =  0)" from nasty typo bugs. Though compiler
warns about it with -Wall flag.

-- 
Manavendra Nath Manav

_______________________________________________
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