[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1C9DE7D1@AcuExch.aculab.com>
Date: Fri, 24 Oct 2014 13:10:10 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Sergei Shtylyov' <sergei.shtylyov@...entembedded.com>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: Akeem G Abodunrin <akeem.g.abodunrin@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>,
"jogreene@...hat.com" <jogreene@...hat.com>,
Patrick Lu <patrick.lu@...el.com>
Subject: RE: [net-next 8/9] i40e: Moving variable declaration out of the
loops
From: Sergei Shtylyov
> Hello.
>
> On 10/24/2014 8:10 AM, Jeff Kirsher wrote:
>
> > From: Akeem G Abodunrin <akeem.g.abodunrin@...el.com>
>
> > Move the three variables out of the loop, so it only declares once.
>
> It's only declared once in either case. I think gcc allocates maximum
> local variable space at the start of the function, so declaring variables in
> the loop body comes with no extra price.
It won't make much (if any) difference to the generated code.
However it is generally easier for the human reader to find definitions
if they are at the top of the function.
Personally the only time I declare variables in an inner scope is when
that scope is very small.
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" 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