Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
- Subject: Re: Overkill - Declaration of 'XXX' shadows a member of 'this'
- From: Keary Suska <email@hidden>
- Date: Tue, 16 Feb 2010 08:22:30 -0700
On Feb 16, 2010, at 4: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;
> }
>
> Is there any way to disable this warning whilst still retaining the intended use case (without renaming all my input parameters)
No. I was involved in a discussion about this some time ago. GCC doesn't distinguish between variables and functions. Perhaps a static analyzer like clang will provide the functionality you want.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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