 




<?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: where does in memory the contant variable in C get store?</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/where-does-in-memory-the-contant-variable-in-c-get-store/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/where-does-in-memory-the-contant-variable-in-c-get-store/</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 18:27:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: yuvalshavit</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/where-does-in-memory-the-contant-variable-in-c-get-store/#comment-54458</link>
		<dc:creator>yuvalshavit</dc:creator>
		<pubDate>Tue, 08 Jul 2008 14:20:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-54458</guid>
		<description><![CDATA[Take this with a grain of salt, but I believe they are not stored in either the stack or the heap.  Because they&#039;re constant, consts are evaluated at compile-time and plugged straight into the machine code.  So as an example, if you have a const AVG_CHILDREN=2.5, then &lt;i&gt;familySize = 2+ AVG_CHILDREN;&lt;/i&gt; is exactly the same as &lt;i&gt;familySize = 4 + 2.5;&lt;/i&gt; (which would itself be optimized to just &lt;i&gt;familySize = 6.5;&lt;/i&gt;).

The advantage of using the const as opposed to just typing in 2.5 is that if the average number of children per family changes, you have to alter just one line of code -- the const declaration -- instead of finding every instance of that 2.5 and changing it.]]></description>
		<content:encoded><![CDATA[<p>Take this with a grain of salt, but I believe they are not stored in either the stack or the heap.  Because they&#8217;re constant, consts are evaluated at compile-time and plugged straight into the machine code.  So as an example, if you have a const AVG_CHILDREN=2.5, then <i>familySize = 2+ AVG_CHILDREN;</i> is exactly the same as <i>familySize = 4 + 2.5;</i> (which would itself be optimized to just <i>familySize = 6.5;</i>).</p>
<p>The advantage of using the const as opposed to just typing in 2.5 is that if the average number of children per family changes, you have to alter just one line of code &#8212; the const declaration &#8212; instead of finding every instance of that 2.5 and changing it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.013 seconds using memcached
Object Caching 268/271 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 20:08:25 -->