• 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: Checkboxes and NSBox titles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checkboxes and NSBox titles


  • Subject: Re: Checkboxes and NSBox titles
  • From: John Hörnkvist <email@hidden>
  • Date: Wed, 13 Jun 2001 11:57:13 +0200

On Wednesday, June 13, 2001, at 04:09 AM, Fritz Anderson wrote:

Begging pardon, but I thought one did
- (void) setMyVal: (id) newVal
{
[myVal autorelease];
myVal = [newVal retain];
}

... yes? Because those methods are no-ops when sent to nil, and -retain always returns self? No need for conditionals, and no fear of deallocating myVal if myVal==newVal?


I prefer this form:
- (void) setMyVal: (id) newVal
{
[newVal retain];
[myVal release];
myVal =newVal;
}

It avoids autorelease, and as I see it is much better description of what you want to do.


Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


  • Follow-Ups:
    • Re: Checkboxes and NSBox titles
      • From: Jim Correia <email@hidden>
References: 
 >Re: Checkboxes and NSBox titles (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: WWDC Developer Tools Online - question
  • Next by Date: Re: Checkboxes and NSBox titles
  • Previous by thread: Re: Checkboxes and NSBox titles
  • Next by thread: Re: Checkboxes and NSBox titles
  • Index(es):
    • Date
    • Thread