[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3f1fe70-1270-602c-08ba-b8ba5acbe224@users.sourceforge.net>
Date: Thu, 21 Jul 2016 14:47:24 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: Wolfram Sang <wsa@...-dreams.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: staging: ks7010: Delete unnecessary uses of the variable "retval"
> I think the original code was fine.
I suggest to reconsider involved implementation details once more.
> x = blah(); if (x) ... is a perfectly familiar kernel coding pattern.
I can agree to such a general information.
> There is no benefit in terms of performance
It might be possible that a good compiler can also optimise
some unnecessary variable accesses away.
Examples for further background information:
* "Minimize local variables"
https://eventhelix.com/realtimemantra/basics/optimizingcandcppcode.htm#Minimize%20Local%20Variables
* "Temporary Objects" by Danny Kalev
http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=198
> or understandability in dropping the variable.
I guess that we have got different opinions on such an aspect.
* Do you really want to assign every return value from a function call
to an extra variable before it is used again?
* How many reading and understanding capacity do you need for each
extra variable?
Regards,
Markus
Powered by blists - more mailing lists