lkml.org 
[lkml]   [2015]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value
On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote:
> Removes variable comparison with 0 by using !.

Sometimes testing for zero makes sense. When you write code, you are
telling a story. If you are talking about zero as a number then it
can make sense. If it's zero as a boolean then it doesn't make sense.

Also strcmp() and similar should always be done as == 0, < 0 or != 0
because that is the idiom:

if name != "foo" then

becomes:

if (strcmpt(name, "foo") != 0) {

The != from the first is shifted in the second.

So I don't really think this approach is the right thing. You have to
read the code and understand the story it is telling. Then change it
if needed.

regards,
dan carpenter



\
 
 \ /
  Last update: 2015-04-03 19:21    [W:0.106 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site