<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Java Developer&#8217;s Guide to String Constants in Objective-C</title>
	<atom:link href="http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html</link>
	<description>iOS and Objective-C Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Tue, 22 May 2012 11:53:47 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: John Muchow</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-34343</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Thu, 16 Dec 2010 15:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-34343</guid>
		<description>It&#039;s hard to say why you are receiving the error without seeing the rest of your code. Have you previously defined the variable? Where are you declaring the variable, in a method, as an instance variable? You may cut/paste the definition elsewhere to see if you can narrow down where the error is occurring.</description>
		<content:encoded><![CDATA[<p>It&#8217;s hard to say why you are receiving the error without seeing the rest of your code. Have you previously defined the variable? Where are you declaring the variable, in a method, as an instance variable? You may cut/paste the definition elsewhere to see if you can narrow down where the error is occurring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: follower</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-34320</link>
		<dc:creator>follower</dc:creator>
		<pubDate>Thu, 16 Dec 2010 08:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-34320</guid>
		<description>static NSString *const HTTP_METHOD_POST = @&quot;POST&quot;;

that throws 
static declaration of HTTP_METHOD_POST follows non-static declaration...

Can any of you suggest why i am getting that error.</description>
		<content:encoded><![CDATA[<p>static NSString *const HTTP_METHOD_POST = @&#8221;POST&#8221;;</p>
<p>that throws<br />
static declaration of HTTP_METHOD_POST follows non-static declaration&#8230;</p>
<p>Can any of you suggest why i am getting that error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dnd</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-9526</link>
		<dc:creator>dnd</dc:creator>
		<pubDate>Fri, 12 Feb 2010 11:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-9526</guid>
		<description>@Rodney

&gt;&gt; My experience is with J2ME/Java and CF/C#; in both of those platforms, String literals “add up” and should always be avoided.

I know this is an old post, but I came across it while googling for &#039;constants in objective c&#039;.  I can&#039;t speak for the other environments, but this is not true of Java.

String x = &quot;xxx&quot;;
String y = &quot;xxx;

will result in only one String object being created.  Both x and y will reference the same String object.</description>
		<content:encoded><![CDATA[<p>@Rodney</p>
<p>&gt;&gt; My experience is with J2ME/Java and CF/C#; in both of those platforms, String literals “add up” and should always be avoided.</p>
<p>I know this is an old post, but I came across it while googling for &#8216;constants in objective c&#8217;.  I can&#8217;t speak for the other environments, but this is not true of Java.</p>
<p>String x = &#8220;xxx&#8221;;<br />
String y = &#8220;xxx;</p>
<p>will result in only one String object being created.  Both x and y will reference the same String object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hasnat</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-7006</link>
		<dc:creator>Hasnat</dc:creator>
		<pubDate>Mon, 23 Nov 2009 15:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-7006</guid>
		<description>@david
yes you are correct
you can define in separate header file</description>
		<content:encoded><![CDATA[<p>@david<br />
yes you are correct<br />
you can define in separate header file</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stevebert</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-213</link>
		<dc:creator>stevebert</dc:creator>
		<pubDate>Thu, 05 Feb 2009 19:38:34 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-213</guid>
		<description>You&#039;re not incurring any more expense importing 999 unused #defines just to get that one string constant.  The compiler does not incur any storage allocation just because a #define exists, it has to be used in the code being compiled and then it&#039;s only a pointer reference to a global DATA item where the string constant is stored.  

Of course if you&#039;re using the same .h file across multiple executables, of course each binary will contain a copy of the string constant, but you knew that already.  ;-)</description>
		<content:encoded><![CDATA[<p>You&#8217;re not incurring any more expense importing 999 unused #defines just to get that one string constant.  The compiler does not incur any storage allocation just because a #define exists, it has to be used in the code being compiled and then it&#8217;s only a pointer reference to a global DATA item where the string constant is stored.  </p>
<p>Of course if you&#8217;re using the same .h file across multiple executables, of course each binary will contain a copy of the string constant, but you knew that already.  ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stevebert</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-212</link>
		<dc:creator>stevebert</dc:creator>
		<pubDate>Thu, 05 Feb 2009 19:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-212</guid>
		<description>There&#039;s nothing magic about #defines so including them all in a massive .h is fine.  The pre-processor will substitute the string constants and the compiler will correlate multiple instances of the same string constant.</description>
		<content:encoded><![CDATA[<p>There&#8217;s nothing magic about #defines so including them all in a massive .h is fine.  The pre-processor will substitute the string constants and the compiler will correlate multiple instances of the same string constant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-211</link>
		<dc:creator>david</dc:creator>
		<pubDate>Thu, 05 Feb 2009 12:54:19 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-211</guid>
		<description>so whats the conclusion..whats the better way to declare NSString constants across the application ?

-----------------------------------------------------------------------
I created a .h file and it contents look like

//myconstants.h
#define stringglobal1 @&quot;ssss&quot;
#define string2 @&quot;zzzz&quot;

#define kMywidth 123

//more than 50 constats are there
and in other files I am using #import myconstants.h
I am also importing this header file only for using  a single constant 
-----------------------------------------------------------------------

is it okay ?</description>
		<content:encoded><![CDATA[<p>so whats the conclusion..whats the better way to declare NSString constants across the application ?</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
I created a .h file and it contents look like</p>
<p>//myconstants.h<br />
#define stringglobal1 @&#8221;ssss&#8221;<br />
#define string2 @&#8221;zzzz&#8221;</p>
<p>#define kMywidth 123</p>
<p>//more than 50 constats are there<br />
and in other files I am using #import myconstants.h<br />
I am also importing this header file only for using  a single constant<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>is it okay ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-210</link>
		<dc:creator>david</dc:creator>
		<pubDate>Thu, 05 Feb 2009 12:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-210</guid>
		<description>so whats the conclusion..whats the better way to declare NSString constants across the application ?

-----------------------------------------------------------------------
I created a .h file and it contents look like

//myconstants.h
#define stringglobal1 @&quot;ssss&quot;
#define string2 @&quot;zzzz&quot;

#define kMywidth 123

and in other files I am using #import myconstants.h
-----------------------------------------------------------------------

is it okay ?</description>
		<content:encoded><![CDATA[<p>so whats the conclusion..whats the better way to declare NSString constants across the application ?</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
I created a .h file and it contents look like</p>
<p>//myconstants.h<br />
#define stringglobal1 @&#8221;ssss&#8221;<br />
#define string2 @&#8221;zzzz&#8221;</p>
<p>#define kMywidth 123</p>
<p>and in other files I am using #import myconstants.h<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>is it okay ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stevebert</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-87</link>
		<dc:creator>stevebert</dc:creator>
		<pubDate>Wed, 29 Oct 2008 18:16:54 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-87</guid>
		<description>I have no special insight into the workings of the compiler, but I think the compiler detects the use of @&quot;&quot; string constants and makes instances of an &quot;NSString-like&quot; object in the DATA section of the executable (note the low-address reference for the string).  I say NSString-like because this type of object can never be sent retain or release messages, so is probably not a 1st class NSString instance.  Repeated uses of the string are probably matched by hashing the string literal and matching to an existing instance of the constant.</description>
		<content:encoded><![CDATA[<p>I have no special insight into the workings of the compiler, but I think the compiler detects the use of @&#8221;" string constants and makes instances of an &#8220;NSString-like&#8221; object in the DATA section of the executable (note the low-address reference for the string).  I say NSString-like because this type of object can never be sent retain or release messages, so is probably not a 1st class NSString instance.  Repeated uses of the string are probably matched by hashing the string literal and matching to an existing instance of the constant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodney</title>
		<link>http://MobileDeveloperTips.com/objective-c/java-developers-guide-to-string-constants-in-objective-c.html#comment-86</link>
		<dc:creator>Rodney</dc:creator>
		<pubDate>Wed, 29 Oct 2008 17:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=865#comment-86</guid>
		<description>@Stevebert,

Thanks for the response.  I stand corrected.  It is interesting to see how different ObjC is compared to other languages.  My experience is with J2ME/Java and CF/C#; in both of those platforms, String literals &quot;add up&quot; and should always be avoided.  This is, yet again, an example of how Objective-C excels as a language for mobile application development.

I&#039;ll update the article to include your feedback.  Thanks again!
- Rodney</description>
		<content:encoded><![CDATA[<p>@Stevebert,</p>
<p>Thanks for the response.  I stand corrected.  It is interesting to see how different ObjC is compared to other languages.  My experience is with J2ME/Java and CF/C#; in both of those platforms, String literals &#8220;add up&#8221; and should always be avoided.  This is, yet again, an example of how Objective-C excels as a language for mobile application development.</p>
<p>I&#8217;ll update the article to include your feedback.  Thanks again!<br />
- Rodney</p>
]]></content:encoded>
	</item>
</channel>
</rss>

