<?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"
	>
<channel>
	<title>Comments on: Reading C type declarations</title>
	<atom:link href="http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/</link>
	<description>Eli Bendersky's personal website</description>
	<pubDate>Fri, 21 Nov 2008 19:23:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Miron Brezuleanu</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124830</link>
		<dc:creator>Miron Brezuleanu</dc:creator>
		<pubDate>Wed, 30 Jul 2008 05:38:40 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124830</guid>
		<description>Thanks for the reply,

I've used this as a Haskell programming exercise.
http://haskell.pastebin.com/f4c0d351c

It ended up as a simple C-&#62;English cdecl.

Maybe you're interested.</description>
		<content:encoded><![CDATA[<p>Thanks for the reply,</p>
<p>I&#8217;ve used this as a Haskell programming exercise.<br />
<a href="http://haskell.pastebin.com/f4c0d351c" rel="nofollow">http://haskell.pastebin.com/f4c0d351c</a></p>
<p>It ended up as a simple C-&gt;English cdecl.</p>
<p>Maybe you&#8217;re interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124197</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Sat, 19 Jul 2008 13:15:59 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124197</guid>
		<description>Miron,

This is called an "abstract declarator" in the jargon of K&#038;R2, as opposed to a "declarator" which has a variable name.

1. Go into the innermost grouping parentheses. If there are none, ignore this step.
2. The virtual declarator would appear between the *s and the []s
3. Proceed decoding as a declarator.</description>
		<content:encoded><![CDATA[<p>Miron,</p>
<p>This is called an &#8220;abstract declarator&#8221; in the jargon of K&#038;R2, as opposed to a &#8220;declarator&#8221; which has a variable name.</p>
<p>1. Go into the innermost grouping parentheses. If there are none, ignore this step.<br />
2. The virtual declarator would appear between the *s and the []s<br />
3. Proceed decoding as a declarator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jestine Paul</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124182</link>
		<dc:creator>Jestine Paul</dc:creator>
		<pubDate>Sat, 19 Jul 2008 07:35:43 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124182</guid>
		<description>I sometimes follow this brief description from http://klausler.com/cnotes.txt when reading type declarations

How to easily read a declaration from left to right:
--- transform function argument types from inside out first
--- move the base type to the end
--- add outer parentheses if there's an initial *
--- change every (*...) to ... -&#62;
------------ one -&#62; for each *
------------ move qualifiers, so * const becomes const -&#62;</description>
		<content:encoded><![CDATA[<p>I sometimes follow this brief description from <a href="http://klausler.com/cnotes.txt" rel="nofollow">http://klausler.com/cnotes.txt</a> when reading type declarations</p>
<p>How to easily read a declaration from left to right:<br />
&#8212; transform function argument types from inside out first<br />
&#8212; move the base type to the end<br />
&#8212; add outer parentheses if there&#8217;s an initial *<br />
&#8212; change every (*&#8230;) to &#8230; -&gt;<br />
&#8212;&#8212;&#8212;&#8212; one -&gt; for each *<br />
&#8212;&#8212;&#8212;&#8212; move qualifiers, so * const becomes const -&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miron Brezuleanu</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124171</link>
		<dc:creator>Miron Brezuleanu</dc:creator>
		<pubDate>Sat, 19 Jul 2008 05:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124171</guid>
		<description>What about declarations that do not have a variable identifier? Example:
int f(int (*)());

This declares a function that return an int and takes a function pointer as argument. The function pointer is a nested declaration, and it doesn't use a variable name. How do you figure out where to start when parsing the nested declaration?</description>
		<content:encoded><![CDATA[<p>What about declarations that do not have a variable identifier? Example:<br />
int f(int (*)());</p>
<p>This declares a function that return an int and takes a function pointer as argument. The function pointer is a nested declaration, and it doesn&#8217;t use a variable name. How do you figure out where to start when parsing the nested declaration?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124137</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Fri, 18 Jul 2008 15:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124137</guid>
		<description>Thanks for all the comments (here and on &lt;a href="http://www.reddit.com/r/programming/info/6sd4e/comments/" rel="nofollow"&gt;Proggit&lt;/a&gt;)- I've incorporated some of the information into the article.

Kia Kroas: why, pointing out typos *is* important. Thanks, fixed.</description>
		<content:encoded><![CDATA[<p>Thanks for all the comments (here and on <a href="http://www.reddit.com/r/programming/info/6sd4e/comments/" rel="nofollow">Proggit</a>)- I&#8217;ve incorporated some of the information into the article.</p>
<p>Kia Kroas: why, pointing out typos *is* important. Thanks, fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kia Kroas</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124128</link>
		<dc:creator>Kia Kroas</dc:creator>
		<pubDate>Fri, 18 Jul 2008 14:01:06 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124128</guid>
		<description>I'm not usually one to point out typos, but...in your second code box, you have inx instead of int.
"inx x[5];"
s/inx/int/

Otherwise, it was a nice, useful post.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not usually one to point out typos, but&#8230;in your second code box, you have inx instead of int.<br />
&#8220;inx x[5];&#8221;<br />
s/inx/int/</p>
<p>Otherwise, it was a nice, useful post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bernz</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124125</link>
		<dc:creator>bernz</dc:creator>
		<pubDate>Fri, 18 Jul 2008 13:53:14 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124125</guid>
		<description>Anyone who actually uses "char *(*(**foo [][8])())[]" must be smoking some pretty heavy stuff.  :-)  Tip: When pretending you are a C parser, read type definitions from the inside, out.</description>
		<content:encoded><![CDATA[<p>Anyone who actually uses &#8220;char *(*(**foo [][8])())[]&#8221; must be smoking some pretty heavy stuff.  <img src='http://eli.thegreenplace.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Tip: When pretending you are a C parser, read type definitions from the inside, out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miro</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124121</link>
		<dc:creator>miro</dc:creator>
		<pubDate>Fri, 18 Jul 2008 11:39:38 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124121</guid>
		<description>Heh or just use a typedef :D
Granted it is complex (pascal has much nicer rules).</description>
		<content:encoded><![CDATA[<p>Heh or just use a typedef <img src='http://eli.thegreenplace.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Granted it is complex (pascal has much nicer rules).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pádraig Brady</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124119</link>
		<dc:creator>Pádraig Brady</dc:creator>
		<pubDate>Fri, 18 Jul 2008 11:12:44 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124119</guid>
		<description>$ cdecl explain "char *(*(**foo [][8])())[];"
declare foo as array of array 8 of pointer to pointer to function returning pointer to array of pointer to char</description>
		<content:encoded><![CDATA[<p>$ cdecl explain &#8220;char *(*(**foo [][8])())[];&#8221;<br />
declare foo as array of array 8 of pointer to pointer to function returning pointer to array of pointer to char</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remko Tronçon</title>
		<link>http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124113</link>
		<dc:creator>Remko Tronçon</dc:creator>
		<pubDate>Fri, 18 Jul 2008 09:46:42 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/07/18/reading-c-type-declarations/#comment-124113</guid>
		<description>I was about to say the same thing: If you want another good tutorial on reading C types, check out the excellent 'Expert C Programming' by Peter van der Linden.</description>
		<content:encoded><![CDATA[<p>I was about to say the same thing: If you want another good tutorial on reading C types, check out the excellent &#8216;Expert C Programming&#8217; by Peter van der Linden.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
