<?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: 7.12 &#8212; Handling errors (assert, cerr, exit, and exceptions)</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: newUser</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-95331</link>
		<dc:creator>newUser</dc:creator>
		<pubDate>Fri, 15 Apr 2011 01:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-95331</guid>
		<description>I&#039;m still wondering how a good assert should be written. Like should it be written a line above a for statement while copying the statement&#039;s arguements? If this is correct, might we want to put this in the tutorial as a &quot;best practices&quot; while giving context to how it&#039;s written?</description>
		<content:encoded><![CDATA[<p>I&#8217;m still wondering how a good assert should be written. Like should it be written a line above a for statement while copying the statement&#8217;s arguements? If this is correct, might we want to put this in the tutorial as a &#8220;best practices&#8221; while giving context to how it&#8217;s written?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SWEngineer</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-95124</link>
		<dc:creator>SWEngineer</dc:creator>
		<pubDate>Sun, 23 Jan 2011 11:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-95124</guid>
		<description>Thanks for the tutorial.

Shouldn&#039;t &quot;GetValue(-3)&quot; here under &quot;Assert&quot; be &quot;GetArrayValue(-3)&quot;?

If the user calls GetValue(-3), the program prints the following message: .....</description>
		<content:encoded><![CDATA[<p>Thanks for the tutorial.</p>
<p>Shouldn&#8217;t &#8220;GetValue(-3)&#8221; here under &#8220;Assert&#8221; be &#8220;GetArrayValue(-3)&#8221;?</p>
<p>If the user calls GetValue(-3), the program prints the following message: &#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-91392</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Sat, 04 Sep 2010 16:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-91392</guid>
		<description>The actual file is obviously iostream.h, but when you include it it is &lt;pre&gt;&lt;iostream&gt;&lt;!--formatted--&gt;&lt;/pre&gt; You might wanna re-read the header file chapter.</description>
		<content:encoded><![CDATA[<p>The actual file is obviously iostream.h, but when you include it it is
<pre>&lt;iostream&gt;<!--formatted--></pre>
<p> You might wanna re-read the header file chapter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-90624</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Fri, 20 Aug 2010 22:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-90624</guid>
		<description>If the user calls GetValue(-3), the program prints the following message:

Should be  GetArrayValue</description>
		<content:encoded><![CDATA[<p>If the user calls GetValue(-3), the program prints the following message:</p>
<p>Should be  GetArrayValue</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: baldo</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-66470</link>
		<dc:creator>baldo</dc:creator>
		<pubDate>Mon, 17 Aug 2009 14:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-66470</guid>
		<description>You said: &quot;&lt;strong&gt;cerr&lt;/strong&gt; is an output stream (just like cout) that is also defined in iostream.h&quot;. It is iostream or iostream.h?</description>
		<content:encoded><![CDATA[<p>You said: &#8220;<strong>cerr</strong> is an output stream (just like cout) that is also defined in iostream.h&#8221;. It is iostream or iostream.h?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred Schneider</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-64974</link>
		<dc:creator>Fred Schneider</dc:creator>
		<pubDate>Sat, 25 Jul 2009 03:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-64974</guid>
		<description>&lt;pre&gt;
// Delcare an array of 10 integers
int *panData = new int[10];
// If something went wrong
if (!panData)
    exit(2); // exit the program with error code 2
panData[5] = 3;
&lt;/pre&gt;

This example is extremely outdated (1993 or so).

Nowadays, new operators through a bad_alloc exception if it can&#039;t allocate the memory.  So, it&#039;s not necessary to check if panData==0 but exception handling should be implemented somewhere in your code.  If you don&#039;t catch the error, and you don&#039;t re-define the unexpected() or terminate() functions, your program will terminate anyways making the safety/correctness of the statement: panData[5]=3; irrelevant.</description>
		<content:encoded><![CDATA[<pre>
// Delcare an array of 10 integers
int *panData = new int[10];
// If something went wrong
if (!panData)
    exit(2); // exit the program with error code 2
panData[5] = 3;
</pre>
<p>This example is extremely outdated (1993 or so).</p>
<p>Nowadays, new operators through a bad_alloc exception if it can&#8217;t allocate the memory.  So, it&#8217;s not necessary to check if panData==0 but exception handling should be implemented somewhere in your code.  If you don&#8217;t catch the error, and you don&#8217;t re-define the unexpected() or terminate() functions, your program will terminate anyways making the safety/correctness of the statement: panData[5]=3; irrelevant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dusty</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-64776</link>
		<dc:creator>Dusty</dc:creator>
		<pubDate>Wed, 22 Jul 2009 12:38:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-64776</guid>
		<description>To answer that question Michel, it&#039;s good practice to put your own error handling in where ever possible.

The error handling can be used to put the errors into terms that the end user can understand, not just the programmer.

Error handling is not just good for debugging code, it&#039;s also good to help point out errors in live programs being used by a client or user.

Alex THANK YOU FOR THIS ARTICLE!! I just sent it to a friend of mine who needed to see this, shall we say. ;)</description>
		<content:encoded><![CDATA[<p>To answer that question Michel, it&#8217;s good practice to put your own error handling in where ever possible.</p>
<p>The error handling can be used to put the errors into terms that the end user can understand, not just the programmer.</p>
<p>Error handling is not just good for debugging code, it&#8217;s also good to help point out errors in live programs being used by a client or user.</p>
<p>Alex THANK YOU FOR THIS ARTICLE!! I just sent it to a friend of mine who needed to see this, shall we say. ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-64150</link>
		<dc:creator>Michel</dc:creator>
		<pubDate>Sat, 11 Jul 2009 17:24:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-64150</guid>
		<description>On Visual Studio 2008 Professional Edition, when an error is created, it states all the information in the Error List including which file and which line in that file the error occured. Therefore, do you need to use the assert() function when you are using VS 08 Pro?</description>
		<content:encoded><![CDATA[<p>On Visual Studio 2008 Professional Edition, when an error is created, it states all the information in the Error List including which file and which line in that file the error occured. Therefore, do you need to use the assert() function when you are using VS 08 Pro?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tip C/C++: assert vs exception &#124; La plaga Tux</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-63844</link>
		<dc:creator>Tip C/C++: assert vs exception &#124; La plaga Tux</dc:creator>
		<pubDate>Mon, 06 Jul 2009 22:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-63844</guid>
		<description>[...] http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/            No olvides valorar la entrada - Ninguna votación aún :(  &#160;Loading ... [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/" rel="nofollow">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/</a>            No olvides valorar la entrada &#8211; Ninguna votación aún :(  &nbsp;Loading &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anwaar</title>
		<link>http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/comment-page-1/#comment-60545</link>
		<dc:creator>anwaar</dc:creator>
		<pubDate>Tue, 12 May 2009 01:15:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/712-handling-errors-assert-cerr-exit-and-exceptions/#comment-60545</guid>
		<description>no arjun! ur while is just for to check validity of positive numbers within the bound of lenght of declared string, but other one was also to check the either user has also entered a negative number.</description>
		<content:encoded><![CDATA[<p>no arjun! ur while is just for to check validity of positive numbers within the bound of lenght of declared string, but other one was also to check the either user has also entered a negative number.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

