    <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  :: An Apology</title>
        <link>https://members.accu.org/index.php/articles/881</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">CVu Journal Vol 11, #4 - Jun 1999</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/c76/">Journals</a>

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

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c131/">114</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;An Apology</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 June 1999 13:15:31 +01:00 or Thu, 03 June 1999 13:15:31 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e16" id="d0e16"></a></h2>
</div>
<p>Last issue I managed to provide some code that should not
compile on any compliant system even though it would be reasonable
for it to work. Please accept my apologies for any
inconvenience.</p>
<p>First let me consider a little code that does work:</p>
<pre class="programlisting">
void fn(){
  char message[100] = &quot;&quot;;
  // do something
}
</pre>
<p>The array of char called message is declared with an
initialiser. The result in this case is to zero all the elements of
the array. The rule is simple, once you start initialising an array
it is all initialised (with default constructors for the part that
has not been explicitly initialised). Note that though I am
thinking of <tt class="varname">message</tt> as a string, it is an
array of <tt class="type">char</tt>. The declaration is equivalent
to:</p>
<pre class="programlisting">
  char message[100] = {'\0'};
</pre>
<p>Now there is at least one place in C++ where you are not
permitted to use an initialiser for an array, that is in a
constructor initialiser list.</p>
<p>You are not allowed to initialise an array of char in a
constructor. It will have to be done in the body of the
constructor.</p>
<p>The constructor I provide for student on page 39 of C Vu 11.3
will not work. To my mind this is just one more reason for using
the C++ <tt class="type">string</tt> type rather than the C array
of <tt class="type">char</tt>.</p>
<p>I must confess that I am not sure why C++ does not allow
initialisation of arrays in ctors. The efficiency aspects are
exactly the same as those in C (do not initialise at all and assign
the ones you want versus initialise everything). The problem is
that C++ requires you to hand code complete initialisation of any
array that is a member of a user defined type. This seems an
unnecessary burden.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
