• 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
self.property vs. ivar of same name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

self.property vs. ivar of same name?


  • Subject: self.property vs. ivar of same name?
  • From: Rick Mann <email@hidden>
  • Date: Sat, 8 Mar 2008 11:29:21 -0800

I was mucking about with some sample code. It had a property "window" that was synthesized using @property, and an ivar of the same name. The code referred to it using "self.window =". Since I generally dislike using "self" or "this" unnecessarily, i removed the "self.", thinking it would still work, but it didn't.

Why is that? I get that "self.window =" is calling the synthesized setter method, but "window =" should have just assigned to the ivar and all should've been the same, right? The property was declared with (nonatomic, retain).

Is the difference that using the property caused the retain count to go up by one? I'll try the experiment, but I'd sure like confirmation.

TIA,
--
Rick

_______________________________________________
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: self.property vs. ivar of same name?
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Trouble Upgrading to Xcode 2.5
  • Next by Date: iPhone Simulator Won't Start w/ Xcode 3.1
  • Previous by thread: Re: Trouble Upgrading to Xcode 2.5
  • Next by thread: Re: self.property vs. ivar of same name?
  • Index(es):
    • Date
    • Thread