lkml.org 
[lkml]   [2008]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mm: Don't touch uninitialized variable in do_pages_stat_array()


On Tue, 16 Dec 2008, Joe Perches wrote:
>
> Perhaps this is more legible and avoids
> the unnecessary assignments to err.

Not only is it less legible to me, but the "unnecessary" assignments are
the ones that make the flow control much simpler.

I think it's a _lot_ easier to read

retval = BADNESS;
if (something bad)
goto out;

than it is to make the insides of the conditional more complex. It also
tends to generate better code, although gcc's code movement often makes it
not matter (and equally often makes a mess of it). That's because a

if (something)
goto somewhere;

is actually how the CPU itself ends up executing things, while a

if (something) {
retval = something;
goto somewhere;
}

actually ends up becoming

if (!someting)
goto over;
retval = something;
goto somewhere;
over:

by the time the CPU actually has to execute it.

Linus


\
 
 \ /
  Last update: 2008-12-16 21:39    [W:0.055 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site