<?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: Bringing try catch blocks to C</title>
	<atom:link href="http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/</link>
	<description>Notes on Computation and Physics</description>
	<pubDate>Fri, 21 Nov 2008 14:17:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Ben Lindelof</title>
		<link>http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-1396</link>
		<dc:creator>Ben Lindelof</dc:creator>
		<pubDate>Sat, 15 Dec 2007 00:04:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-1396</guid>
		<description>Should I start with C or C++?

Exception errors are a good way to learn a new language, as I found with VB.NET.</description>
		<content:encoded><![CDATA[<p>Should I start with C or C++?</p>
<p>Exception errors are a good way to learn a new language, as I found with VB.NET.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bgoncalves</title>
		<link>http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-683</link>
		<dc:creator>bgoncalves</dc:creator>
		<pubDate>Fri, 19 Oct 2007 22:08:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-683</guid>
		<description>I explain how to create a similar mechanism in C, despite the lack of Classes or any OOP concepts. The fact that I use a macro as a form of throwing the "exceptions" gives the added advantage that you can completely turn off error checking at compile time if you choose to do so.
Of course, there are limitation to this approach... namely, my "exceptions" can't propagate up the stack. I believe this is a limitation of C for which there is no work around. If you know one, I would very much like to hear it.
If you want something even closer to the way try-catch blocks are normally used you can do:

&lt;pre lang="C"&gt;#define try(code) {do{code}while(0);}
#define catch(err,code) {if(error==err){code}}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I explain how to create a similar mechanism in C, despite the lack of Classes or any OOP concepts. The fact that I use a macro as a form of throwing the &#8220;exceptions&#8221; gives the added advantage that you can completely turn off error checking at compile time if you choose to do so.<br />
Of course, there are limitation to this approach&#8230; namely, my &#8220;exceptions&#8221; can&#8217;t propagate up the stack. I believe this is a limitation of C for which there is no work around. If you know one, I would very much like to hear it.<br />
If you want something even closer to the way try-catch blocks are normally used you can do:</p>

<div class="wp_syntax"><div class="code"><pre class="c"><span style="color: #339933;">#define try(code) {do{code}while(0);}</span>
<span style="color: #339933;">#define catch(err,code) {if(error==err){code}}</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-682</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 19 Oct 2007 21:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.bgoncalves.com/notes/2007/10/19/bringing-try-catch-blocks-to-c/#comment-682</guid>
		<description>Misleading. You neither describe exceptions nor try-catch blocks in C.</description>
		<content:encoded><![CDATA[<p>Misleading. You neither describe exceptions nor try-catch blocks in C.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
