• 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: Newbie question: constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question: constants


  • Subject: Re: Newbie question: constants
  • From: Wade Tregaskis <email@hidden>
  • Date: Fri, 19 Nov 2004 16:34:09 +1100

I'm not aware of any compiler flag at all which allows you to dictate to
the compiler to *not* remove duplicate instances of static data. I do plead
ignorance to the behavior of 'ld'.

There are some linkers that do not remove duplicates by default. I believe gcc's linker fell or falls into this class, at some point in time. I know it has been an issue in past. As I said, I think XCode explicitly asks it to remove duplicates, but I am not certain.


In the case of simple types or NSStrings, my design is neither poor nor
flat out wrong. There is no way to change the object 'myString' at all. By
definition, any string declared at compile time with the @"" notation is an
immutable string. Apple uses the same construct for their Cocoa constants.
Defining an NSNumber object as a constant is a bit trickier.

The scenario I was referring to was using a mutable object - e.g. NSNumber as you suggest - as a constant. I wasn't picking on your method in particular, just stating it only works for truly immutable objects.


Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN & email: email@hidden, Jabber: email@hidden)
-- Sed quis custodiet ipsos custodes?


_______________________________________________
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


  • Follow-Ups:
    • Re: Newbie question: constants
      • From: Tim Hart <email@hidden>
    • Re: Newbie question: constants
      • From: Tim Hart <email@hidden>
References: 
 >Newbie question: constants (From: "Colin O'Connor" <email@hidden>)
 >Re: Newbie question: constants (From: Wade Tregaskis <email@hidden>)
 >Re: Newbie question: constants (From: Tim Hart <email@hidden>)
 >Re: Newbie question: constants (From: Wade Tregaskis <email@hidden>)
 >Re: Newbie question: constants (From: Tim Hart <email@hidden>)

  • Prev by Date: Re: Newbie question: constants
  • Next by Date: Re: Mail plugins for modifying headers on outgoing messages
  • Previous by thread: Re: Newbie question: constants
  • Next by thread: Re: Newbie question: constants
  • Index(es):
    • Date
    • Thread