• 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: NSDate Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDate Question


  • Subject: Re: NSDate Question
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 8 Dec 2006 12:26:09 -0500
  • Organization: Rogue Research

On 2006-12-08 09:19, Roland Torres said:

>> - (void)setMyDate:(NSDate *)aMyDate
>> {
>>     if (myDate != aMyDate) {
>>         [myDate release];
>>         myDate = [aMyDate copy];
>>     }
>> }
>
>Noob question here.
>Is doing:
>   myDate = [aMyDate copy];
>preferable to doing:
>   myDate = [aMyDate retain];

This could become a long discussion... You might want to google
'accessor patterns'.

But ask yourself: "Do I want the value, or the actual object?"  For the
former use 'copy' for the latter use 'retain'.  I would think with a
date, it's the value that's more interesting.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSDate Question
      • From: Alastair Houghton <email@hidden>
References: 
 >NSDate Question (From: Matt <email@hidden>)
 >Re: NSDate Question (From: "Sean McBride" <email@hidden>)
 >Re: NSDate Question (From: Roland Torres <email@hidden>)

  • Prev by Date: Re: NSDate Question
  • Next by Date: NSMenu question
  • Previous by thread: Re: NSDate Question
  • Next by thread: Re: NSDate Question
  • Index(es):
    • Date
    • Thread