Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows) global variable
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 2015-01-15 14:43:43
On January 15, 2015 12:57:45 PM EST, Beman Dawes <bdawes_at_[hidden]> wrote:
> On Thu, Jan 15, 2015 at 10:19 AM, Rob Stewart
> <rob.stewart_at_[hidden]> wrote:
> >> > * Prefix function argument names with "a_". Rationale: The "m_"
> >> prefix
> >> > for member names has been a success.
> > Really? I think it's ugly.
> Yes, that's why it is a success. It is ugly so users don't want to use
> it themselves, so it avoids the shadow warning issue.
I guess that's one way of looking at it.
> >> Despite that the warnings should probably be fixed, I don't think
> >> there is need for a naming policy.
> > Normally, I'd dismiss such warnings as unwanted noise, but given
> Beman's anecdotal evidence of the benefit of addressing them, I'm
> inclined to agree that they should be addressed.
> It isn't just me; a quick search finds comments like "The clang
> -Wshadow warning is quite nice as code which trips it often has bugs
> due to accidentally referencing the wrong identically named variable"
> and a complaint Apple defaults to no shadow warnings.
(Sent from my portable computation engine)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk