• 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: Keys of the kingdom
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keys of the kingdom


  • Subject: Re: Keys of the kingdom
  • From: Boyd Collier <email@hidden>
  • Date: Sun, 23 Apr 2006 15:56:24 -0700

Shawn,

Thanks very much for the suggestions and especially for your succinct review of some details, below, that I'd forgotten.

Boyd


On Apr 22, 2006, at 4:32 PM, Shawn Erickson wrote:


On Apr 22, 2006, at 3:58 PM, Ryan Britton wrote:

const NSString *MSFileBackupDate = @"MSFileBackupDate";

The above says that "MSFileBackupDate" is a pointer to a constant NSString instance. The problem with this definition is that the 'MSFileBackupDate" variable (the pointer) can be modified and hence the object it points at could be changed. Normally you don't want your keys to be changeable.


So it you should do one of the following...

1) NSString* const MSFileBackupDate = @"MSFileBackupDate";

2) const NSString* const MSFileBackupDate = @"MSFileBackupDate";

In (1) you have a immutable pointer to an NSString instance and in (2) you have a immutable pointer to an immutable NSString instance. The second option is generally redundant since NSString is by definition immutable and since the NSString object is instantiated using @"some string" you have a special variant of NSString that not only is immutable but is also constant (not possible for it to be deallocated, currently they are instances of CFConstantString IIRC).

-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40sunstroke.sdsu.edu


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Keys of the kingdom (From: Kevin Bracey <email@hidden>)
 >Re: Keys of the kingdom (From: Ondra Cada <email@hidden>)
 >Re: Keys of the kingdom (From: Boyd Collier <email@hidden>)
 >Re: Keys of the kingdom (From: Ryan Britton <email@hidden>)
 >Re: Keys of the kingdom (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Should Cocoa Apps have splash screens at all ?
  • Next by Date: Re: Superimpose a NSTextField over NSImageView?
  • Previous by thread: Re: Keys of the kingdom
  • Next by thread: Re: Keys of the kingdom - THANKS!
  • Index(es):
    • Date
    • Thread