Skip navigation.
 
mlRe: How do I disable this warning: "local declaration of 'varname' hides instance variable"
FROM : charlie
DATE : Mon Mar 24 04:59:04 2008

For years, I've been doing this:

- (void)setController:(id)_controller
{
  if (!_controller)
  {
    return;
  }
  controller = [_controller retain];
}



It has always irked me having to work around namespace conflicts
between method args and instance variables.

So, today I decided to try this for my next project...

- (void)setController:(id)controller
{
  if (!controller)
  {
    return;
  }
  self->controller = [controller retain];
}



I works fine.  But does not fix the warning itself.




So, the question stands.... How do I suppress the warning.


- Chuck








On March 23, 2008, Michael Watson wrote:

> If you've rewritten your code to fix the conflict, you shouldn't be 
> getting the warning. What does "coded around the namespace conflict" 
> mean, exactly?
>
>
> --
> m-s
>
> On 23 Mar, 2008, at 22:56, charlie wrote:

>>
>> Thanks.
>>
>> I understand the reason behind the warning.
>>
>> I've coded around the namrspace conflict.
>>
>> Now I just want to suppress the warning.
>>
>> - Chuck
>>
>>
>>
>>
>>
>>
>> On March 23, 2008, Andrew Farmer wrote:
>>

>>> On 23 Mar 08, at 19:29, charlie wrote:

>>>> How do I disable this warning?...
>>>> "local declaration of 'varname' hides instance variable"

>>> Use a different name for either the local variable or the instance 
>>> variable. This is a serious enough warning that I really wouldn't 
>>> recommend disabling it.

>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (<email_removed>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/mikey-san
>> %40bungie.org
>>
>> This email sent to <email_removed>

>

Related mailsAuthorDate
mlRe: How do I disable this warning: "local declaration of 'varname' hides instance variable" charlie Mar 24, 04:59
mlRe: How do I disable this warning: "local declaration of 'varname' hides instance variable" j o a r Mar 24, 05:12
mlRe: How do I disable this warning: "local declaration of 'varname' hides instance variable" Sherm Pendley Mar 24, 05:18
mlRe: How do I disable this warning: "local declaration of 'varname' hides instance variable" Dave Hersey Mar 24, 05:49