From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH 0/6] Remove some usage of shadow variable Date: Wed, 28 Oct 2015 10:44:21 +0100 Message-ID: <563098F5.3060709@suse.com> References: <1445960359-17217-1-git-send-email-julien.grall@citrix.com> <562FAE5002000078000AF3C2@prv-mh.provo.novell.com> <56309AFF02000078000AF718@prv-mh.provo.novell.com> <56309174.8010608@suse.com> <5630A40302000078000AF75C@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZrNW9-0002a4-Nz for xen-devel@lists.xenproject.org; Wed, 28 Oct 2015 09:59:41 +0000 In-Reply-To: <5630A40302000078000AF75C@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: KeirFraser , IanCampbell , George Dunlap , Dario Faggioli , Tim Deegan , Julien Grall , Stefano Stabellini , xen-devel List-Id: xen-devel@lists.xenproject.org On 10/28/2015 10:31 AM, Jan Beulich wrote: >>>> On 28.10.15 at 10:12, wrote: >> On 10/28/2015 09:53 AM, Jan Beulich wrote: >>> And second variables >>> whose name is kind of natural (e.g. "d" for struct domain * instances) >>> but which are intentionally shadowing a larger scope one in order to >>> not clobber that one's value. >> >> Hmm, wouldn't something like tmp_d or d_tmp be a proper solution? > > Ugly. Really ugly. Maybe. OTOH I'm quite sure there is a name which would be acceptable. Otherwise we couldn't write code referencing two different domains via local variables without making it ugly. >> There are other cases where more than one domain reference are needed >> and it was possible to find proper variable names. > > Yes, resulting in e.g. "e" being used for a struct domain * in grant > table code. Very natural a name for this kind of object. Bad examples are always possible. This is no excuse not to use compiler features which help us to avoid bugs. Juergen