• 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: warning: local declaration hides instance variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warning: local declaration hides instance variable


  • Subject: Re: warning: local declaration hides instance variable
  • From: Shawn Erickson <email@hidden>
  • Date: Mon, 03 Sep 2007 10:48:48 -0700


On Sep 3, 2007, at 10:33 AM, Tron Thomas wrote:

If I do something equivalent in C++ like:
class Value
{
private:
   int value;
public:
   void SetValue(int value)
   {
       this->value = value;
   };
};

I don't get any warnings. What is the reason for the warning in Objective-C and no warning in C++?

Objective-C is a superset of C not C++ ;-)

Likely the compiler is simply not bothering to check if uses of the lvar really do hide the ivar. File a defect if you want [1] but in general you don't normally see much objective-c code accessing ivars via struct references. In other words it is a case that isn't seen much so their may not be much interest in changing it.

-Shawn

[1] <http://developer.apple.com/bugreporter/>

_______________________________________________
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


  • Follow-Ups:
    • Re: warning: local declaration hides instance variable
      • From: Tron Thomas <email@hidden>
References: 
 >warning: local declaration hides instance variable (From: Tron Thomas <email@hidden>)
 >Re: warning: local declaration hides instance variable (From: Shawn Erickson <email@hidden>)
 >Re: warning: local declaration hides instance variable (From: Tron Thomas <email@hidden>)

  • Prev by Date: Re: warning: local declaration hides instance variable
  • Next by Date: Re: warning: local declaration hides instance variable
  • Previous by thread: Re: warning: local declaration hides instance variable
  • Next by thread: Re: warning: local declaration hides instance variable
  • Index(es):
    • Date
    • Thread