[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080618100624.GE15255@elte.hu>
Date: Wed, 18 Jun 2008 12:06:24 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Neil Horman <nhorman@...driver.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, mingo@...hat.com,
torvalds@...ux-foundation.org
Subject: Re: [PATCH] shm: Remove silly double assignment
* Neil Horman <nhorman@...driver.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists