lkml.org 
[lkml]   [2008]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] shm: Remove silly double assignment

* Neil Horman <nhorman@tuxdriver.com> wrote:

> > Not silly, really. Look:
> >
> > err = -ENOMEM;
> > if (expr1)
> > goto out;
> >
> > err = -ENOMEM;
> > if (expr2)
> > goto out;
> >
> > each of these two units is a separate, self-contained clause.
> > Removing the second assignment to `err' breaks that separation and
> > will make one clause undesirably dependent upon the other.
>
> yes, I see that keeping the second assignment lets you insert code in
> the middle without having up to update afterwards. I just don't think
> the redundant assignment is worth keeping just for that purpose.

cleanups is all about having familar, robust, predictable,
self-contained patterns of code that are easy to recognize, easy to
review and easy to keep working well.

In this case we've got an admittedly boundary case: removing the
technically redundant piece of code, while a valid cleanup at first
sight, makes the code less robust against future changes.

Ingo


\
 
 \ /
  Last update: 2008-06-18 12:09    [W:0.033 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site