• 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: Chris Hanson <email@hidden>
  • Date: Mon, 3 Sep 2007 22:24:42 -0700

On Sep 3, 2007, at 11:52 AM, Laurence Harris wrote:

An even better solution would be to rename your instance variables with a standard naming convention that clearly identifies them as instance variables. Since they're also referred to as member variables, a lot of people prefix their names with an "m":

Instance variables in Objective-C are not referred to as member variables; it's not common to prefix them with "m." The most common prefix I've seen is the underscore. This is because instance variables whose name starts with an underscore are automatically discovered by Key-Value Coding just as un-prefixed instance variables are; instance variables with other prefixes will not be discovered by Key-Value Coding or any mechanisms built atop it (such as Key-Value Observing or Cocoa Bindings).


For more information on Cocoa naming conventions, see the Coding Guidelines for Cocoa.

  Coding Guidelines for Cocoa
  http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html

It's a document that anyone coming to Cocoa from other environments should read; it describes what idiomatic Cocoa code looks like, so you don't appear to be writing C, C++ Java, or C#/VB.NET code using Objective-C syntax.

  -- Chris

_______________________________________________
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: 
 >warning: local declaration hides instance variable (From: Tron Thomas <email@hidden>)
 >Re: warning: local declaration hides instance variable (From: Wincent Colaiuta <email@hidden>)
 >Re: warning: local declaration hides instance variable (From: Laurence Harris <email@hidden>)

  • Prev by Date: Re: Getting rid of Obj-C "may not respond to" warning
  • Next by Date: Re: Getting rid of Obj-C "may not respond to" warning
  • Previous by thread: Re: warning: local declaration hides instance variable
  • Next by thread: RE: warning: local declaration hides instance variable
  • Index(es):
    • Date
    • Thread