<?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/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: C in a Nutshell in a Nutshell</title>
	<atom:link href="http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/</link>
	<description>All my thoughts that are fit to blog. Which mostly consists of stuff about programming.</description>
	<lastBuildDate>Fri, 17 Jun 2011 21:02:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Of Braces and Semicolons &#124; The Rebertian Times</title>
		<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/comment-page-1/#comment-25</link>
		<dc:creator>Of Braces and Semicolons &#124; The Rebertian Times</dc:creator>
		<pubDate>Sun, 24 Jan 2010 16:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rebertia.com/?p=133#comment-25</guid>
		<description>[...] up to the second part of this blog&#8217;s tagline by being about programming! (Well, there was C in a Nutshell2, but my point is it&#8217;s been a [...]</description>
		<content:encoded><![CDATA[<p>[...] up to the second part of this blog&#8217;s tagline by being about programming! (Well, there was C in a Nutshell2, but my point is it&#8217;s been a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Rebert</title>
		<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/comment-page-1/#comment-24</link>
		<dc:creator>Chris Rebert</dc:creator>
		<pubDate>Wed, 06 Jan 2010 19:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rebertia.com/?p=133#comment-24</guid>
		<description>Yes, and in assembly language you get to know that definition quite well as you have to do the pointer arithmetic and dereferencing yourself (I recently took a class on assembly programming). I&#039;ve now added this 3rd (and defining) array access method to the post.

Thanks for your comment; it means some people actually do read my blog :-)</description>
		<content:encoded><![CDATA[<p>Yes, and in assembly language you get to know that definition quite well as you have to do the pointer arithmetic and dereferencing yourself (I recently took a class on assembly programming). I&#8217;ve now added this 3rd (and defining) array access method to the post.</p>
<p>Thanks for your comment; it means some people actually do read my blog :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Rebert</title>
		<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/comment-page-1/#comment-23</link>
		<dc:creator>Chris Rebert</dc:creator>
		<pubDate>Wed, 06 Jan 2010 19:15:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rebertia.com/?p=133#comment-23</guid>
		<description>Excellent point. I&#039;ve now changed the example accordingly. Thanks!</description>
		<content:encoded><![CDATA[<p>Excellent point. I&#8217;ve now changed the example accordingly. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emre Guney</title>
		<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/comment-page-1/#comment-22</link>
		<dc:creator>Emre Guney</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rebertia.com/?p=133#comment-22</guid>
		<description>&lt;cite&gt; Function-like macros: #define foo(a,b) a-b &lt;/cite&gt;

Since macros are directly replaced in the code, they could be error-prone when used like functions. Therefore I strongly suggest &lt;em&gt; using parenthesis in the macro definition &lt;em&gt; to avoid errors due to operator precedence s.t.
&lt;code&gt; #define foo(a,b) (a-b) &lt;/code&gt;
or in the following common case:
&lt;code&gt; #define sq(a) ((a)*(a)) &lt;/code&gt;

e.g. without parenthesis
&lt;code&gt; foo(3,2)*5 &lt;/code&gt;
expected:
&lt;code&gt; 5 &lt;/code&gt;
got:
&lt;code&gt; -7 &lt;/code&gt; (3-2*5)
&lt;code&gt; sq(3-2) &lt;/code&gt;
expected:
&lt;code&gt; 1 &lt;/code&gt;
got:
&lt;code&gt; -5 &lt;/code&gt; (3-2*3-2)</description>
		<content:encoded><![CDATA[<p><cite> Function-like macros: #define foo(a,b) a-b </cite></p>
<p>Since macros are directly replaced in the code, they could be error-prone when used like functions. Therefore I strongly suggest <em> using parenthesis in the macro definition </em><em> to avoid errors due to operator precedence s.t.<br />
<code> #define foo(a,b) (a-b) </code><br />
or in the following common case:<br />
<code> #define sq(a) ((a)*(a)) </code></p>
<p>e.g. without parenthesis<br />
<code> foo(3,2)*5 </code><br />
expected:<br />
<code> 5 </code><br />
got:<br />
<code> -7 </code> (3-2*5)<br />
<code> sq(3-2) </code><br />
expected:<br />
<code> 1 </code><br />
got:<br />
<code> -5 </code> (3-2*3-2)</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff McNeil</title>
		<link>http://blog.rebertia.com/2009/04/04/c-in-a-nutshell-in-a-nutshell/comment-page-1/#comment-21</link>
		<dc:creator>Jeff McNeil</dc:creator>
		<pubDate>Thu, 17 Dec 2009 21:57:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rebertia.com/?p=133#comment-21</guid>
		<description>I realize this is in response to an old post, but &quot;index[array] ≡ array[index]&quot; caught my eye.  That&#039;s one of the odd trivia like interview questions I&#039;ll ask. It makes people stop and think what an array in C really is.   There&#039;s actually another way of accessing an array element:

&lt;pre&gt;
atl3itlt0350:~ jmcneil$ cat test.c
#include

int
main (int *argc, char *argv[])
{
   int num_array[] = {1,2,3,4,5};

   printf(&quot;Method One: %d\n&quot;, num_array[2]);
   printf(&quot;Method Two: %d\n&quot;, 2[num_array]);
   printf(&quot;Method Three: %d\n&quot;, *(num_array+2));

   return 0;
}
atl3itlt0350:~ jmcneil$ make test
cc     test.c   -o test
atl3itlt0350:~ jmcneil$ ./test
Method One: 3
Method Two: 3
Method Three: 3
atl3itlt0350:~ jmcneil$
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I realize this is in response to an old post, but &#8220;index[array] ≡ array[index]&#8221; caught my eye.  That&#8217;s one of the odd trivia like interview questions I&#8217;ll ask. It makes people stop and think what an array in C really is.   There&#8217;s actually another way of accessing an array element:</p>
<pre>
atl3itlt0350:~ jmcneil$ cat test.c
#include

int
main (int *argc, char *argv[])
{
   int num_array[] = {1,2,3,4,5};

   printf("Method One: %d\n", num_array[2]);
   printf("Method Two: %d\n", 2[num_array]);
   printf("Method Three: %d\n", *(num_array+2));

   return 0;
}
atl3itlt0350:~ jmcneil$ make test
cc     test.c   -o test
atl3itlt0350:~ jmcneil$ ./test
Method One: 3
Method Two: 3
Method Three: 3
atl3itlt0350:~ jmcneil$
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

