• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overkill - Declaration of 'XXX' shadows a member of 'this'


  • Subject: Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
  • From: Matt Gough <email@hidden>
  • Date: Tue, 16 Feb 2010 16:00:46 +0000


On 16 Feb 2010, at 15:20:44, Fritz Anderson wrote:

On 16 Feb 2010, at 5:19 AM, Matt Gough wrote:

I just turned on GCC_WARN_SHADOW in the hope of finding those rare occasions where a local var shadows another local var at a higher scope and the 'wrong' one gets used. What I didn't expect were the 8000 warnings along the lines of  'Declaration of 'XXX' shadows a member of 'this' .

What is really annoying is that its not complaining about member variables, but method names.

E.g:

class MyClass {
public:
int cheeseType() const {return _cheeseType;}
void setCheeseType(int cheeseType) <==== Declaration of 'cheeseType' shadows a member of 'this'
{_cheeseType = cheeseType;}

private:
int _cheeseType;
}

This is a perfectly reasonable warning, isn't it? Isn't this->cheeseType a pointer to a member function? I wouldn't expect that to be suppressible.


Yes, but the compiler would already catch me trying to do:

cheeseType = someCheeseType

since  you can't assign to a pointer to a member function. What I want to be catching are such things as:

int err = 0;
{
int err = something();
if (err || ConfirmDiskNeedsErasing())
err = 0; // oops. wrong err was reset to zero. Bye bye disk.
}
if (!err)
EraseEntireHardDiskWithNoChanceOfRecovery();

(Not real code BTW)

Matt
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Overkill - Declaration of 'XXX' shadows a member of 'this' (From: Matt Gough <email@hidden>)
 >Re: Overkill - Declaration of 'XXX' shadows a member of 'this' (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Code Signing for Mac application
  • Next by Date: Re: Xcode performance issues over time
  • Previous by thread: Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
  • Next by thread: Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
  • Index(es):
    • Date
    • Thread