<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: The lie of C++ exceptions</title>
	<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/</link>
	<description>A blog on the development of the NGEDIT text editor</description>
	<pubDate>Thu, 29 Jul 2010 23:54:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: The growing pains of NGEDIT &#187; Blog Archive &#187; Focusing my development effort</title>
		<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-236</link>
		<dc:creator>The growing pains of NGEDIT &#187; Blog Archive &#187; Focusing my development effort</dc:creator>
		<pubDate>Thu, 24 Nov 2005 17:57:12 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-236</guid>
		<description>[...] The growing pains of NGEDIT A blog on the development of the NGEDIT text editor      &#171; The lie of C++ exceptions [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] The growing pains of NGEDIT A blog on the development of the NGEDIT text editor      &laquo; The lie of C++ exceptions [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-229</link>
		<dc:creator>J</dc:creator>
		<pubDate>Fri, 18 Nov 2005 15:40:06 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-229</guid>
		<description>Sebastian, I haven't read that book. I've been researching the subject since yesterday, and one of the articles I came up with after searching for "c++ exception strong guarantee" was by Abrahams. I also read some stuff by Herb Sutter.

I plan on following up with the issue. I actually might try to nail it down, and reach a conclusion, at least with regards to my needs. Ie, conclude what it would mean to write my C++ code based around exceptions, and make my mind up for once.

I have the intuition, although I'm not sure yet, that it is actually more involved than explicit error handling - I mean, in an &lt;em&gt;objective&lt;/em&gt; way.</description>
		<content:encoded><![CDATA[<p>Sebastian, I haven&#8217;t read that book. I&#8217;ve been researching the subject since yesterday, and one of the articles I came up with after searching for &#8220;c++ exception strong guarantee&#8221; was by Abrahams. I also read some stuff by Herb Sutter.</p>
<p>I plan on following up with the issue. I actually might try to nail it down, and reach a conclusion, at least with regards to my needs. Ie, conclude what it would mean to write my C++ code based around exceptions, and make my mind up for once.</p>
<p>I have the intuition, although I&#8217;m not sure yet, that it is actually more involved than explicit error handling - I mean, in an <em>objective</em> way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian Wagner</title>
		<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-226</link>
		<dc:creator>Sebastian Wagner</dc:creator>
		<pubDate>Thu, 17 Nov 2005 22:35:13 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-226</guid>
		<description>Heya, excellent thoughts, really. Regarding a pointer into the right direction, have you read "Exceptional C++" by Herb Sutter? Also, Abrahams over at boost is an exception handling guru and has written down a thing or two.</description>
		<content:encoded><![CDATA[<p>Heya, excellent thoughts, really. Regarding a pointer into the right direction, have you read &#8220;Exceptional C++&#8221; by Herb Sutter? Also, Abrahams over at boost is an exception handling guru and has written down a thing or two.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-212</link>
		<dc:creator>J</dc:creator>
		<pubDate>Thu, 17 Nov 2005 17:00:14 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-212</guid>
		<description>curious,

Thanks for the pointer - I've started to research that framework based on guarantees. I'm probably less educated in C++ than I should, but I do dedicate a lot of thinking to try to find the fundamental issues.

It actually seems the transaction semantics are described, with non-throwing in the "commit" phase being a need. At early research, I haven't seen a description of how a full framework should operate and its application in each situation - the guarantees are also tools to implement the error handling system, and I'm trying to figure out the whole policy.

Anyway, I'm starting to see a way that exception-based error handling could work. Do you have a pointer to some kind of complete description?

I think that, as a rule, a function needs to guarantee state to a any data which is not local (globals - yes they exist -, function arguments, and any other data obtained through them). So it must do a kind of "transaction based" operation on them. Member variables modified from methods have to be treated like that as well.

Regarding your question about my "improvement", it goes along the simple line of:

if (m_vector_whatever.push_back() == RET_OK)
{
  // Explicit handling of everything: undoing, restoring well-known state, ...
}

I would probably be willing to move to exceptions if I can figure out the whole error generation framework - I think that even if exception handling currently impacts runtime performance, it could be optimized and it will probably be in future compilers (using whole-program analysis).</description>
		<content:encoded><![CDATA[<p>curious,</p>
<p>Thanks for the pointer - I&#8217;ve started to research that framework based on guarantees. I&#8217;m probably less educated in C++ than I should, but I do dedicate a lot of thinking to try to find the fundamental issues.</p>
<p>It actually seems the transaction semantics are described, with non-throwing in the &#8220;commit&#8221; phase being a need. At early research, I haven&#8217;t seen a description of how a full framework should operate and its application in each situation - the guarantees are also tools to implement the error handling system, and I&#8217;m trying to figure out the whole policy.</p>
<p>Anyway, I&#8217;m starting to see a way that exception-based error handling could work. Do you have a pointer to some kind of complete description?</p>
<p>I think that, as a rule, a function needs to guarantee state to a any data which is not local (globals - yes they exist -, function arguments, and any other data obtained through them). So it must do a kind of &#8220;transaction based&#8221; operation on them. Member variables modified from methods have to be treated like that as well.</p>
<p>Regarding your question about my &#8220;improvement&#8221;, it goes along the simple line of:</p>
<p>if (m_vector_whatever.push_back() == RET_OK)<br />
{<br />
  // Explicit handling of everything: undoing, restoring well-known state, &#8230;<br />
}</p>
<p>I would probably be willing to move to exceptions if I can figure out the whole error generation framework - I think that even if exception handling currently impacts runtime performance, it could be optimized and it will probably be in future compilers (using whole-program analysis).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: curious</title>
		<link>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-208</link>
		<dc:creator>curious</dc:creator>
		<pubDate>Thu, 17 Nov 2005 15:06:19 +0000</pubDate>
		<guid>http://blog.ngedit.com/2005/11/17/the-lie-of-c-exceptions/#comment-208</guid>
		<description>How will you improve your example if you didn't use exceptions?
One more thing you are forgetting is that there are three exception guarantees:
1. Basic - no resource leaks, object remains in a valid state.
2. Strong - same as basic, but object remains in the state before and after the expception is thrown.
3. No throw - no exceptions can be thrown.

In your post you are only talking about strong guarantee, and forgetting the other two. You must decide what guarantee is appropriate for each of your classes, when building a system that uses exceptions.</description>
		<content:encoded><![CDATA[<p>How will you improve your example if you didn&#8217;t use exceptions?<br />
One more thing you are forgetting is that there are three exception guarantees:<br />
1. Basic - no resource leaks, object remains in a valid state.<br />
2. Strong - same as basic, but object remains in the state before and after the expception is thrown.<br />
3. No throw - no exceptions can be thrown.</p>
<p>In your post you are only talking about strong guarantee, and forgetting the other two. You must decide what guarantee is appropriate for each of your classes, when building a system that uses exceptions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
