The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	torvalds@linux-foundation.org
Subject: Re: [PATCH] shm: Remove silly double assignment
Date: Wed, 18 Jun 2008 12:06:24 +0200	[thread overview]
Message-ID: <20080618100624.GE15255@elte.hu> (raw)
In-Reply-To: <20080611170321.GA23507@hmsreliant.think-freely.org>


* 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

      reply	other threads:[~2008-06-18 10:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 12:53 [PATCH] shm: Remove silly double assignment Neil Horman
2008-06-11 10:45 ` Andrew Morton
2008-06-11 17:03   ` Neil Horman
2008-06-18 10:06     ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080618100624.GE15255@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nhorman@tuxdriver.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox