Re: Newbie question: constants
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