<?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/"
		>
<channel>
	<title>Comments on: Exception specifications</title>
	<atom:link href="http://efesx.com/2009/10/06/exception-specifications/feed/" rel="self" type="application/rss+xml" />
	<link>http://efesx.com/2009/10/06/exception-specifications/</link>
	<description>Technical &#38; low level</description>
	<lastBuildDate>Mon, 30 Apr 2012 17:39:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: rmn</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-79</link>
		<dc:creator>rmn</dc:creator>
		<pubDate>Thu, 18 Nov 2010 16:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-79</guid>
		<description>That&#039;s true. I have linked Boost&#039;s recommendation against using expcetion specifications in my first comment on this thread as well.

Thanks for posting.</description>
		<content:encoded><![CDATA[<p>That&#8217;s true. I have linked Boost&#8217;s recommendation against using expcetion specifications in my first comment on this thread as well.</p>
<p>Thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eli</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-78</link>
		<dc:creator>Eli</dc:creator>
		<pubDate>Thu, 18 Nov 2010 11:33:30 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-78</guid>
		<description>Keep in mind that Herb Sutter discourages the usage of exception specifications (sources: http://www.gotw.ca/gotw/082.htm and http://www.gotw.ca/publications/mill22.htm). He says the Boost programmers (among whom you find a few people in the C++ standards committee) recommend not using them as well.</description>
		<content:encoded><![CDATA[<p>Keep in mind that Herb Sutter discourages the usage of exception specifications (sources: <a href="http://www.gotw.ca/gotw/082.htm" rel="nofollow">http://www.gotw.ca/gotw/082.htm</a> and <a href="http://www.gotw.ca/publications/mill22.htm" rel="nofollow">http://www.gotw.ca/publications/mill22.htm</a>). He says the Boost programmers (among whom you find a few people in the C++ standards committee) recommend not using them as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-77</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 10 Feb 2010 19:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-77</guid>
		<description>Technically yes. But there&#039;s a subtle difference.  Errors are usually unrecoverable, or require drastic action to fix.

Java, correctly, makes the distinction between these and other situations that are less problematic.

Generally I see many instances where errors have been treated by throwing exceptions. Essentially the programmer is being lazy and saying &#039;yeah... I can&#039;t be bothered to deal with this cleanly, so I&#039;ll pass the buck.&#039;  These don&#039;t need exceptions; they need proper error handling!</description>
		<content:encoded><![CDATA[<p>Technically yes. But there&#8217;s a subtle difference.  Errors are usually unrecoverable, or require drastic action to fix.</p>
<p>Java, correctly, makes the distinction between these and other situations that are less problematic.</p>
<p>Generally I see many instances where errors have been treated by throwing exceptions. Essentially the programmer is being lazy and saying &#8216;yeah&#8230; I can&#8217;t be bothered to deal with this cleanly, so I&#8217;ll pass the buck.&#8217;  These don&#8217;t need exceptions; they need proper error handling!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rmn</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-76</link>
		<dc:creator>rmn</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-76</guid>
		<description>I agree!

Just a little note though; Errors are an exception in a way. Errors happen when there&#039;s something not quite right - i.e, when there&#039;s an exception. :)</description>
		<content:encoded><![CDATA[<p>I agree!</p>
<p>Just a little note though; Errors are an exception in a way. Errors happen when there&#8217;s something not quite right &#8211; i.e, when there&#8217;s an exception. <img src='http://efesx.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-75</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 10 Feb 2010 04:29:28 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-75</guid>
		<description>Actually, the Java enforcement is quite OK.

The problem isn&#039;t the enforcement; it&#039;s the proliferation of exceptions.  Exceptions are meant to be just that: exceptions.  They&#039;re not meant to be just another way to handle errors.

If people followed this rule, exception handling would be easy.</description>
		<content:encoded><![CDATA[<p>Actually, the Java enforcement is quite OK.</p>
<p>The problem isn&#8217;t the enforcement; it&#8217;s the proliferation of exceptions.  Exceptions are meant to be just that: exceptions.  They&#8217;re not meant to be just another way to handle errors.</p>
<p>If people followed this rule, exception handling would be easy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rmn</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-74</link>
		<dc:creator>rmn</dc:creator>
		<pubDate>Mon, 19 Oct 2009 18:04:30 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-74</guid>
		<description>I actually can&#039;t stress enough how seriously I dislike the way Java forces you to handle exceptions. You just can&#039;t write a single line of code without making ~5 catch clauses around it, and that basically kills my creativity.
However, I think that documenting code thoroughly is a must in any software project, thus exception specifications can be a very good thing in that they provide this extra documentation (which is even enforced).</description>
		<content:encoded><![CDATA[<p>I actually can&#8217;t stress enough how seriously I dislike the way Java forces you to handle exceptions. You just can&#8217;t write a single line of code without making ~5 catch clauses around it, and that basically kills my creativity.<br />
However, I think that documenting code thoroughly is a must in any software project, thus exception specifications can be a very good thing in that they provide this extra documentation (which is even enforced).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alon</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-73</link>
		<dc:creator>alon</dc:creator>
		<pubDate>Fri, 16 Oct 2009 15:01:41 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-73</guid>
		<description>So you prefer the Java way for enforcing.... :)</description>
		<content:encoded><![CDATA[<p>So you prefer the Java way for enforcing&#8230;. <img src='http://efesx.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rmn</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-72</link>
		<dc:creator>rmn</dc:creator>
		<pubDate>Wed, 07 Oct 2009 14:39:55 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-72</guid>
		<description>The runtime penalty is more in cases where the function MAY throw, but doesn&#039;t actually (for example when you&#039;re implementing an interface or foreseeing inheritance), and the exception specification actually prevents the compiler from optimizing. 
For example, here&#039;s why Boost doesn&#039;t use exception specifications: http://www.boost.org/development/requirements.html#Exception-specification

The solution you suggest (compiler flag) is esentially the same as treating the exceptions you expect to happen and putting an assert(0) on a catch all (catch (...)). Then the assert will be removed on release builds automatically while still providing the needed checking during test phase.

However, I do believe that exception specifications are good as they provide a far better contract (that is also enforced) between the caller and the callee. The problem is in the fact that the enforcement is done in run time and not in compile time.. You would never want your program to terminate with an std::unexpected() in a released version.</description>
		<content:encoded><![CDATA[<p>The runtime penalty is more in cases where the function MAY throw, but doesn&#8217;t actually (for example when you&#8217;re implementing an interface or foreseeing inheritance), and the exception specification actually prevents the compiler from optimizing.<br />
For example, here&#8217;s why Boost doesn&#8217;t use exception specifications: <a href="http://www.boost.org/development/requirements.html#Exception-specification" rel="nofollow">http://www.boost.org/development/requirements.html#Exception-specification</a></p>
<p>The solution you suggest (compiler flag) is esentially the same as treating the exceptions you expect to happen and putting an assert(0) on a catch all (catch (&#8230;)). Then the assert will be removed on release builds automatically while still providing the needed checking during test phase.</p>
<p>However, I do believe that exception specifications are good as they provide a far better contract (that is also enforced) between the caller and the callee. The problem is in the fact that the enforcement is done in run time and not in compile time.. You would never want your program to terminate with an std::unexpected() in a released version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lorg</title>
		<link>http://efesx.com/2009/10/06/exception-specifications/#comment-71</link>
		<dc:creator>lorg</dc:creator>
		<pubDate>Tue, 06 Oct 2009 20:58:11 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=323#comment-71</guid>
		<description>While I like the idea of exception specification, I think it&#039;s too much bureaucracy. 
Still, I disagree with your sentiment &quot;which is huge in my eyes, but still not worth the runtime penalty&quot;. What is the runtime penalty? Can you tell? Doesn&#039;t it depend on whether or not the actual application you are developing is time critical?
If it is indeed time critical, the desired behavior I&#039;d want is to be able to have a compiler flag to disable/enable exception specifications. 
That way, you can enable them for tests and make sure you never[1] throw unexpected, and disable them for release builds.

[1] as certain as your code coverage by tests allows you to be.</description>
		<content:encoded><![CDATA[<p>While I like the idea of exception specification, I think it&#8217;s too much bureaucracy.<br />
Still, I disagree with your sentiment &#8220;which is huge in my eyes, but still not worth the runtime penalty&#8221;. What is the runtime penalty? Can you tell? Doesn&#8217;t it depend on whether or not the actual application you are developing is time critical?<br />
If it is indeed time critical, the desired behavior I&#8217;d want is to be able to have a compiler flag to disable/enable exception specifications.<br />
That way, you can enable them for tests and make sure you never[1] throw unexpected, and disable them for release builds.</p>
<p>[1] as certain as your code coverage by tests allows you to be.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

