• 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: How far with accessors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How far with accessors?


  • Subject: Re: How far with accessors?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 27 May 2004 02:06:21 +0200

Jeff,

On 26.5.2004, at 23:58, Jeff Biggus wrote:

>> -(void)dealloc {
>> [self setTheString:nil];
>> ...
>> }
>
> Perhaps I need to read the whole thread, but I've never seen it
> suggested that one should simply nil out an object. In general, the
> preferred way is simply to do a release:

You seem to miss that my code does not "simply nil", but nil through
the setter. Since the setter *must* be written so that it releases the
previous value before setting the new one, bingo!

The advantage is that this automatically uses autorelease or release
depending on the accessor pattern you use, it does not break if you
change the internal representation, yadda yadda...
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Fwd: How far with accessors? (From: Ondra Cada <email@hidden>)
 >Re: How far with accessors? (From: Jeff Biggus <email@hidden>)

  • Prev by Date: Re: window rotation
  • Next by Date: Re: monitoring retainCount
  • Previous by thread: Re: How far with accessors?
  • Next by thread: Re: How to put together 21 chunks of XCode 1.2?
  • Index(es):
    • Date
    • Thread