From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: KeirFraser <keir@xen.org>, IanCampbell <ian.campbell@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
Tim Deegan <tim@xen.org>, Julien Grall <julien.grall@citrix.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 0/6] Remove some usage of shadow variable
Date: Wed, 28 Oct 2015 10:44:21 +0100 [thread overview]
Message-ID: <563098F5.3060709@suse.com> (raw)
In-Reply-To: <5630A40302000078000AF75C@prv-mh.provo.novell.com>
On 10/28/2015 10:31 AM, Jan Beulich wrote:
>>>> On 28.10.15 at 10:12, <JGross@suse.com> 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
next prev parent reply other threads:[~2015-10-28 9:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 15:39 [PATCH 0/6] Remove some usage of shadow variable Julien Grall
2015-10-27 15:39 ` [PATCH 1/6] xen/arm: domain_build: Avoid to shadow the variable "mod" in write_properties Julien Grall
2015-11-03 17:01 ` Ian Campbell
2015-10-27 15:39 ` [PATCH 2/6] xen/common: domain: Avoid to shadow the variable "d" in do_vcpu_op Julien Grall
2015-10-27 15:39 ` [PATCH 3/6] xen/common: grant_table: Avoid to shadow "frame" in __gnttab_map_grant_ref Julien Grall
2015-10-27 16:22 ` Jan Beulich
2015-10-27 15:39 ` [PATCH 4/6] xen/common: memory: Avoid to shadow the variable "d" in do_memory_op Julien Grall
2015-10-27 16:25 ` Jan Beulich
2015-10-27 16:51 ` Julien Grall
2015-10-27 15:39 ` [PATCH 5/6] xen/common: sched: Avoid to shadow the variable "cur" in runq_tickle Julien Grall
2015-10-27 15:59 ` Dario Faggioli
2015-10-27 16:27 ` Jan Beulich
2015-10-27 17:00 ` Julien Grall
2015-10-27 15:39 ` [PATCH 6/6] xen/common: sched-rt: Avoid to shadow the variable "svc" in rt_dom_cntl Julien Grall
2015-10-27 16:17 ` Dario Faggioli
2015-10-27 16:03 ` [PATCH 0/6] Remove some usage of shadow variable Jan Beulich
2015-10-27 17:41 ` George Dunlap
2015-10-28 8:53 ` Jan Beulich
2015-10-28 9:10 ` Julien Grall
2015-10-28 9:27 ` Jan Beulich
2015-10-28 9:12 ` Juergen Gross
2015-10-28 9:31 ` Jan Beulich
2015-10-28 9:44 ` Juergen Gross [this message]
2015-10-28 10:50 ` George Dunlap
2015-10-28 11:50 ` Jan Beulich
2015-10-27 16:12 ` Andrew Cooper
2015-10-27 17:39 ` George Dunlap
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=563098F5.3060709@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=julien.grall@citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.