Re: [PATCH v2 1/4] reset: gpio: Add GPIO-based reset controller

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

 



On 07/01/2024 11:46, Biju Das wrote:
>>>> +
>>>> +	if (!platdata || !*platdata)
>>>
>>> Maybe, if (!(platdata && *platdata)) which reduces 1 inversion
>> operation.
>>
>> I would not call it easier to understand... To me !A and !*A are quite
>> obvious and easy to read instantly because !A is obvious: check if it is
>> not NULL. Therefore original check is obvious: is NULL or points to NULL?
>> Then exit.
>>
>> Now your check is a bit more complicated. It is not even frequent code
>> pattern which my brain used to see. You want to check if both are not NULL
>> and then negate it, wait, no, opposite, check if they are something and
>> then negate? To me it is really opposite of readable code.
> 
> I agree maybe it is not readable, even though it reduces 1 extra operation.
> 

Number of operations does not matter. Code readability matters.
Compilers are nowadays smarter than us, so don't write code more
difficult to read just to optimize some instruction like this.

Best regards,
Krzysztof




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux