[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 0/6] Remove some usage of shadow variable



>>> On 28.10.15 at 10:12, <JGross@xxxxxxxx> 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.

> 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.

>> Risking - along the lines of what Andrew said - build breakage for
>> random people, just due to the gcc version they happen to use?
>> I'm usually getting pretty upset when running into problems specific
>> to certain gcc versions, where people fairly clearly didn't think about
>> making their code sufficiently general. I don't know how people will
>> feel if we intentionally break their build (well, not really intentionally,
>> but we'd intentionally take the risk of doing so).
> 
> Is it really true that an older gcc might barf while a new one doesn't
> in case of shadowing? I don't think so. A test build with -Wshadow using
> the most recent gcc succeeding should do so with an older gcc as well.

Perhaps Andrew can give an example or two. I'm not myself
aware of issues in this area (perhaps largely because I don't often
work with code turning on -Wshadow).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.