    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Exception Errors</title>
        <link>https://members.accu.org/index.php/articles/572</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + Overload Journal #29 - Dec 1998</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c78/">Overload</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c199/">29</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-199/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+199/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Exception Errors</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 27 December 1999 17:23:23 +00:00 or Mon, 27 December 1999 17:23:23 +00:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e18" id="d0e18"></a></h2>
</div>
<p>Dear John, I just received Overload 28, and am as usual baffled
by The Harpist. This time, however, I think it may be his or your
fault as well as mine...</p>
<p>On P20 column 1, the Harpist begins a paragraph 'The last of
these mechanisms', at which point one's eyes flick up to the
paragraph above, to find a list - the last item is calling exit().
I think actually the Harpist means that returning an error code is
not possible in destructors - but he definitely got me scratching
my head.</p>
<p>In column 2 of P20 he declares a constructor like this</p>
<pre class="programlisting">
CanFail() : failed(true)
{
  failed = true;
}
</pre>
<p>Which doesn't strike me as very handy either. I suppose he
meant</p>
<pre class="programlisting">
CanFail() : failed(true)
{
  failed = false;
}
</pre>
<p>but even this seems a perversely negative and unclear way of
writing something like</p>
<pre class="programlisting">
bool builtFlag;

CanFail() : builtFlag(false)
{
  // body - maybe can exit here...
  builtFlag = true; 
  // successful construction
}
</pre>
<p>at which point built() becomes a straight accessor function
rather than a strange little negator. Or have I missed the point
entirely? I am a Delphi-head - there, I've admitted it. When
Borland introduced exception handling into its Object Pascal
implementation, the result was cleaner, more natural and safer
code. Since Stroustrup introduced exceptions into C++, my
impression is that resulting C++ code is usually a hideous,
hard-to-read mess full of memory leaks. An impression strongly
reinforced by the wrapped up function at the bottom of page 21
column 2.</p>
<p>The secret of good exception based code in Delphi is that you
very, very rarely need to use the 'except' keyword (approximately
analogous to C++'s 'catch') - see the excellent book 'Delphi
Component Design' by Danny Thorpe for a wonderful discussion of how
Delphi exceptions work.</p>
<p>What the secret of good exception-based code is in C++ I don't
know, but I'm sure this ain't it.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
