lkml.org 
[lkml]   [2020]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end()
From
Date
On Sat, 2020-12-12 at 14:17 +0100, Alexandre Belloni wrote:
> On 12/12/2020 01:16:39-0800, Joe Perches wrote:
> > In this case Alexandre it seems true, but in the generic case
> > it may be false. It may depend on stack size and location.
> >
> > For instance, with large structs declared either at the top
> > of a function or in separate branches within the function:
>
> I think you realize your example is way more complicated than
> initializing basic type variable to 0 or NULL which has probably been
> optimized forever.

Maybe.

Markus does a lot of what most (or perhaps some) consider thoughtless.

A generic point might be maximizing the local scope of declarations.

Maximizing the local scope can make reading easier as the type of an
automatic used for a temporary purpose can be found closer to the code
that uses it. This is especially true for long line-count functions.

IMO: it's a reasonable goal though in this instance perhaps unnecessary.

cheers, Joe


\
 
 \ /
  Last update: 2020-12-12 19:52    [W:0.054 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site