    <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  :: You Write, the Editor Replies</title>
        <link>https://members.accu.org/index.php/articles/945</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">Letters to the Editor + CVu Journal Vol 11, #6 - Oct 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/c184/">Journal Columns</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c186/">LettersEditor</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/c77/">CVu</a>

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

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

                    -                        <a href="https://members.accu.org/index.php/articles/c186+129/">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;You Write, the Editor Replies</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 06 October 1999 13:15:33 +01:00 or Wed, 06 October 1999 13:15:33 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e18" id="d0e18"></a></h2>
</div>
<p>Hi Francis,</p>
<p>I had a few comments scribbled whilst reading recent issues of C
Vu, but I have only just had a chance to email them to you, so some
are now rather late.</p>
<p>(1) Pre-increment Operators</p>
<p>In Code Review - A Big Number class (C Vu 11.4, p 41), the
Harpist's comment on the pre- and post-increment operators was just
&quot;Fine.&quot; Should the pre-increment ones return non-const references
rather than values? I think I have always written mine that way,
and I think they need to conform to the expected &quot;C-style&quot; operator
semantics.</p>
<p class="c2"><span class="remark">I took a few moments to think
about that, and I think not unless you believe that <tt class=
"literal">(i++) = 4;</tt> should work. By returning a value the
compiler will reject such silly code. Returning a non-const
reference might just surprise a programmer with an unexpected
rejection of code but returning such does not seem to add anything
worthwhile. I suspect that it should return a const reference. What
do others think?</span></p>
<p>(2) Code Legibility</p>
<p>(Even longer ago), Silas commented (in C Vu 11.2, p 26) on the
placement of <tt class="literal">*</tt> and <tt class=
"literal">&amp;</tt> in declarations. I know this topic verges on
the religious, but for the longest time I preferred K&amp;R style
placement - i.e. with the variable as <tt class="literal">char
*pc</tt> rather than <tt class="literal">char* pc</tt></p>
<p>for one simple reason: The human eye/brain (mine, anyway!) pays
more attention to the start of words than the end, particularly for
English nouns that rarely inflect. When reading quickly, one tends
to glance at the start of each word and try to interpret it as
quickly as possible before moving on to the next. My note-taking
sometimes uses this fact - when writing fast, suffices like &quot;ing&quot;,
&quot;tion&quot;, and so forth end up as squiggles, but the meaning is often
not lost and I can read my notes quite quickly and effectively
based on the starts of the words. Nouns are often used for the
names of classes, and once you are familiar with the names of your
classes, you tend to identify them quickly, paying most attention
to how they start. As a result, I find I can read code much more
easily and quickly if the often important pointer or reference or
whatever stands out at the start of the variable name, rather than
getting lost at the end of the type. In the following example, my
eye initially breaks up the code:</p>
<pre class="programlisting">
VeryLongClassName&amp; function(AnotherName* a);
</pre>
<p>as a type on the left, a function name, another type and the
variable name, a. Unless I look carefully at each type, it is
harder to decipher them. Putting the <tt class=
"literal">&amp;</tt>s and <tt class="literal">*</tt>s at the start
of the variable makes them much more visible (for me), because they
are at the start of the runs of characters:</p>
<pre class="programlisting">
VeryLongClassName &amp;function(AnotherName *a);
</pre>
<p>This my eye breaks up as a type name, a function name beginning
with an ampersand, another type and a variable beginning with an
asterisk. Unless I do this, I find the <tt class=
"literal">&amp;</tt> and <tt class="literal">*</tt> tend to blend
in to the preceding word so you miss it. Furthermore, a lot of the
code I see and deal with tends to have multiple variable
declarations on a line, so the usual problems of typing</p>
<pre class="programlisting">
char*  a, b;
</pre>
<p>rear their heads.</p>
<p>More recently, though, I have tried switching to the
&quot;space-both-sides&quot; version, and I like the way it makes the
<tt class="literal">*</tt> or <tt class="literal">&amp;</tt> stand
out even further, giving the readability that I appreciated with my
old method. It makes you stop and think.</p>
<pre class="programlisting">
VeryLongClassName &amp; function(AnotherName * a);
</pre>
<p>The only drawback is that, to the uninitiated, these may appear
more similar to the binary <tt class="literal">&amp;</tt> and
<tt class="literal">*</tt> operators, and so possibly lead to
initial confusion.</p>
<p>The fact that the start of words are so important is another
nail in the coffin for long-winded Hungarian prefixes. When you
look at something like &quot;<tt class="varname">m_lpszName</tt>&quot;, you
have to wade through 60% of the word before you reach the purpose
of the variable (a name). I still like and use simple &quot;<tt class=
"varname">m_</tt>&quot; and &quot;<tt class="varname">s_</tt>&quot; scope
prefixes, and the underscores here help you see the start of the
real variable name, but multi-character type encoding (&quot;<tt class=
"varname">lpsz</tt>&quot;, etc.) slows down your reading of the
code.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
