<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Digital Ambulation &#187; snippets</title>
	<atom:link href="http://www.alanbriolat.co.uk/tag/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alanbriolat.co.uk</link>
	<description>Life, programming and general geekery</description>
	<lastBuildDate>Mon, 09 Jan 2012 12:07:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>C linked list macro</title>
		<link>http://www.alanbriolat.co.uk/2008/12/c-linked-list-macro/</link>
		<comments>http://www.alanbriolat.co.uk/2008/12/c-linked-list-macro/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 16:29:00 +0000</pubDate>
		<dc:creator>Alan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://alanbriolat.com/?p=56</guid>
		<description><![CDATA[Here&#8217;s a simple macro I came up with a few weeks ago for easily defining linked list types in C. #define LINKED_LIST(type, name) \ struct name ## _ { \ struct name ## _ * next; \ type data; \ }; \ typedef struct name ## _ name; Usage is simple: LINKED_LIST&#40;int, int_ll&#41;; gives the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple macro I came up with a few weeks ago for easily defining linked list types in C.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#define LINKED_LIST(type, name)     \
    struct name ## _ {              \
        struct name ## _ * next;    \
        type data;                  \
    };                              \
    typedef struct name ## _ name;</span></pre></div></div>

<p>Usage is simple:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">LINKED_LIST<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #339933;">,</span> int_ll<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>gives the same type as</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">struct</span> int_ll_ <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">struct</span> int_ll_ <span style="color: #339933;">*</span> next<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> data<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">typedef</span> int_ll_ int_ll<span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.alanbriolat.co.uk/2008/12/c-linked-list-macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

