lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jul 2016 14:54:26 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
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"



On Thu, 21 Jul 2016, SF Markus Elfring wrote:

> > 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.

A compiler written by an undergrad can optimize the variable away in this
case.  That's what compilers do.

> 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?

If it's a choice between 1) function call on many lines, 2) function call
over 80 characters, and 3) extra variable, I definitely prefer the extra
variable.

julia

>
> * How many reading and understanding capacity do you need for each
>   extra variable?
>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ