To throw or not to throw exceptions?
<p>I was talking to a friend of mine that through my new code I didn't treat exceptions, just because I didn't know how to do it in C++. His answer surprised me: "why in the hell would you want to throw excetions?". I asked him why, but he didn't have a satisfying answer, so I googled it. One of the first pages I found was a blog entry, where the guy who posted wasn't totally against exceptions, but a religious war started in the replies: <a href="http://weblogs.asp.net/alex_papadimoulis/archive/2005/03/29/396141.aspx" rel="nofollow">http://weblogs.asp.net/alex_papadimoulis/archive/2005/03/29/396141.aspx</a></p>

<p>Now I begin to wonder: is it that bad to throw an exception? For a student like I am, is it wrong to learn programming using exceptions as a normal thing? (When I throw exceptions, I catch them in another level of the code to treat them, most of the times). I have a code example, and I want to know what should I do:</p>

<pre><code>int x;
cout &lt;&lt; "Type an integer: ";
cin &gt;&gt; x;
</code></pre>

<p>Anything that is typed there that is not an integer will trigger an exception already, right? This exception should be treated there. But when I have a possible exception inside a class that is being used elsewhere in the program, should I make this method throw an exception so I can treat it wherever I call it or should I make it return a standard value when it has any problems?</p>

<p>The exception is always good, always bad, or something to be used in "exceptional" situations? Why?   </p>
