    <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/899</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, #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/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/c131/">114</a>
<br />

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

                    -                        <a href="https://members.accu.org/index.php/articles/c186+131/">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> 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="d0e20" id="d0e20"></a></h2>
</div>
<p>Hi Francis,</p>
<p>I was interested to see Jon Jagger's article, &quot;Compile Time
Assertions in C&quot;, and your critique of it, in C Vu 11(3).</p>
<p>Some time ago I looked at expressing compile time assertions in
C++ using templates in my /tmp/late/* series, notably &quot;Constraining
template parameter types&quot; (Overload 12) and &quot;Constraining template
parameter values&quot; (Overload 15). The intent is to capture,
document, and enforce a constraint, encapsulating these features
within a template class. Whilst there is a certain amount of
trickery involved, the fact that templates retain their integrity
through the compilation is key to the use of these techniques: poor
as template related compiler diagnostics are, they will still lead
you to the right place.</p>
<p>And this is the problem: the techniques in Jon's article all
rely on /1/ the pre-processor, and /2/ halting compilation.
Pre-processor symbols lose their identity in the process of
compilation, which leads to succinct but useless messages (as
opposed to the long and possibly useful ones - if only we could
tell - typically provided for template related errors ;-&gt;). Thus
I feel that it would lead to both forward development and
maintenance problems.</p>
<p>However, on the plus side, I think Jon's &quot;{yourself}&quot; columns
are valuable in stretching and exploring the limits of C, and in
particular the pre-processor as a language in its own right (as
well as serving a constant reminder why I am not a great fan of
it!). Causing people to stop, think and ask questions is no bad
thing in an industry whose attitude seems to lean increasingly
toward the idea that thinking and questioning are obstacles on the
critical path of any project; that they should be automated or, at
the very least, given their own timesheet code for tracking and
auditing; that dumbing down is a more optimal strategy than wising
up.</p>
<p>Kevlin Henney <tt class="email">&lt;<a href=
"mailto:kevlin@two-sdg.demon.co.uk">kevlin@two-sdg.demon.co.uk</a>&gt;</tt></p>
<p class="c2"><span class="remark">Thanks. As both you and Jon
know, I always welcome his thoughtful and thought provoking
contributions. One thing that certainly distinguishes average ACCU
members from the average programmer is that they abhor dumbing down
and want to learn.</span></p>
<p>Dear Francis,</p>
<p>how is it going? Sorry that I have been out of touch for a while
but my life has been going through all sorts of changes, both in
terms of career and country of habitation...</p>
<p>I am now living in Brussels working for a company called Styrax
Associates as a Java developer and system administrator building
Linux installations for dynamic web sites and all that sort of
thing. All a bit hectic at the moment but looks extremely promising
once the initial development has been done.</p>
<p>The reason that I am writing is because as well as our own
projects which is all done in-house, we are also acting as an
&quot;agent&quot; for placing programmers in external contracts in order to
maintain a good cash flow for the company during the initial
stages.</p>
<p>However, we are experiencing problems in tracking down qualified
experienced programmers in several fields and I thought that with
your contacts in ACCU that you might be able to point people who
are currently looking for work in our direction. We are working
with contracts in France, Belgium, Holland &amp; Luxembourg and are
in need of a wide range of skills including:-</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>Java</p>
</li>
<li>
<p>CORBA</p>
</li>
<li>
<p>Oracle</p>
</li>
<li>
<p>C++</p>
</li>
</ul>
</div>
<p>and other associated fields...</p>
<p>If anyone is looking for work in these regions then it would be
great if you could pass my email address onto them. If they want to
get directly in touch with our personnel guy then they can email
him directly at:-</p>
<p>Pierre Louvrier <tt class="email">&lt;<a href=
"mailto:pl@styrax.com">pl@styrax.com</a>&gt;</tt></p>
<p>Another thing which I noticed recently which might amuse you is
that Ultra Technology have released a new range of processors that
run directly in forth. I haven't had a chance to read up on it in
depth but if you are interested then check out:</p>
<p><a href="http://www.ultratechnology.com" target=
"_top">www.ultratechnology.com</a></p>
<p><a href="http://www.forth.org" target=
"_top">www.forth.org</a></p>
<p>Maybe this is an excuse to brush up on my stack manipulations
(which are sadly extremely rusty)...</p>
<p>Alex Fiennes</p>
<p class="c2"><span class="remark">Alex was one of the very
brightest of my students (and that makes him something very special
because I had more than my share of exceptional pupils. If you are
looking for work and have the requisite skills remember to mention
the source of the contact if you elect to email Pierre.</span></p>
<p>Dear Francis,</p>
<p>In my letter in C Vu 11.3 I made a mistake about livelock.
According to Jean Bacon's &quot;Concurrent Systems&quot; edition 2 p417,
livelock is when a process indefinitely tests a condition that can
never become true. Two other things to look out for are
communications protocols that degenerate into &quot;ping-pong&quot; under
load, and &quot;resource starvation&quot;, when a process needs a lot of
resources but can't find a time when they're all free.</p>
<p>Silas S Brown</p>
<p>Dear Francis,</p>
<p>Do you know of any online tutorials concerning Java or MFC? I
found the Coronado C/C++ tutorials very good. I have read the book
Thinking in Java by Bruce Eckel but found it aimed a bit higher
than I would ideally like.</p>
<p>Hope to hear from you soon.</p>
<p>Saqib Shaikh School: <tt class="email">&lt;<a href=
"mailto:shaikh@rnibncw.demon.co.uk">shaikh@rnibncw.demon.co.uk</a>&gt;</tt></p>
<p>Home: <tt class="email">&lt;<a href=
"mailto:personal@saqib-shaikh.freeserve.co.uk">personal@saqib-shaikh.freeserve.co.uk</a>&gt;</tt></p>
<p class="c2"><span class="remark">Well can anyone help? Please
remember that Saqib is 100% blind so keep email to simple
text.</span></p>
<p>Hi Francis,</p>
<p>This is a response to your invitation for constructive criticism
on the article '<span class="emphasis"><em>All you need to know
about enums</em></span>'.</p>
<p>As I don't know what the intent of the non-appendix material of
the book is, I guess I can't comment too fully on how it fits with
the whole, but I guess the minutiae are something that I can
address.</p>
<p>One question I had was whether you would be giving similar
treatment to <tt class="literal">struct</tt>s and <tt class=
"literal">union</tt>s, as there is a common base that can be
factored out:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>Tag name spaces, the C typedef idiom, and that C++ honours each
of these with a proper type name, as well as supporting
re<tt class="literal">typedef</tt>ing for backward
compatibility.</p>
</li>
<li>
<p>The use of empty types for exceptions. However, I would consider
that the use of enum is non-idiomatic in this context and that an
empty <tt class="literal">struct</tt>, or indeed <tt class=
"literal">class</tt>, is more appropriate. Only when derivation
must be prevented is it appropriate to use <tt class=
"literal">enum</tt>/<tt class="literal">union</tt> over <tt class=
"literal">struct</tt>/<tt class="literal">class</tt>, which is a
point that you can make.</p>
</li>
</ul>
</div>
<p>Factoring out such a section I feel could leave your <tt class=
"literal">enum</tt> material more focused. There is also a case to
be made for a similar tour of <tt class="literal">const</tt>
differences and similarities between C and C++, unless you are
already covering this elsewhere.</p>
<p>I noted a few typos lurking:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>You used <tt class="literal">struct</tt> instead of <tt class=
"literal">enum</tt> for defining <tt class=
"classname">ProgramLimits</tt> on the first page. There is also a
discussion point here: a type name that is for grouping and
annotation only (i.e. a la traits) rather than for declaring
types.</p>
</li>
<li>
<p>You declared <tt class="varname">mazsize</tt> rather than
<tt class="varname">maxsize</tt> for the program limit.</p>
</li>
<li>
<p>There is a comma missing from your definition of the <tt class=
"literal">enum X</tt> type at the beginning of the C++ and enum
section.</p>
</li>
<li>
<p>Some of the code formatting has gone haywire in the box out at
the end, leading to a missing }. Also, there is a namespace
terminated w/ a semi-colon.</p>
</li>
</ul>
</div>
<p>Style issues:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>Leaving the return statement off the end of main may be legal,
but I would say that the jury returned a verdict against it long
ago as a point of style to be encouraged.</p>
</li>
<li>
<p>Type names and namespaces: <tt class="literal">UpperCase</tt> or
<tt class="literal">lowerCase</tt> first letter?</p>
</li>
<li>
<p>Spacing around the = symbol is inconsistent.</p>
</li>
<li>
<p>The i18n issue wrt French and <tt class="literal">enum</tt>s
suggests that <tt class="literal">enum</tt>s are not actually the
answer at all to such a problem, which takes the edge off an
otherwise well made point.</p>
</li>
<li>
<p>Lack of <tt class="literal">const</tt> on the UDC for <tt class=
"varname">myDouble</tt>. On this topic, there is a lot more that
one can say (so far the stuff I have written about it has gone over
10 pages :-&gt;).</p>
</li>
</ul>
</div>
<p>Some topics I noted by omission:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>The use of <tt class="literal">enum</tt> constants and types for
ORing together bitfields in C vs in C++.</p>
</li>
<li>
<p>There is no <tt class="literal">enum</tt> inheritance in C++ -
besides, it wouldn't be meaningful in the sense that most people
would want it.</p>
</li>
</ul>
</div>
<p>Also, a comment on tone: it's conversational, but perhaps a
little too subjunctive/non-committal in places: whilst it's good to
raise questions from the reader, I guess I would expect a more
assertive tone in a book, especially in an appendix. What do you
think?</p>
<p>Anyway, hope this helps. I look forward to your comments on my
offerings in the near future!</p>
<p>Kevlin Henney <tt class="email">&lt;<a href=
"mailto:kevlin@two-sdg.demon.co.uk">kevlin@two-sdg.demon.co.uk</a>&gt;</tt></p>
<p class="c2"><span class="remark">Quite a number of readers
responded to my request. Kevlin's was the most thorough which is
why I am publishing his and the following one rather than the
others. Note how much Kevlin has found to comment on. Next time you
read a technical book think about how thorough a job the technical
reviewers have done. Books should be far more polished than
magazine articles.</span></p>
<p class="c2"><span class="remark">Thanks to all who took the
trouble to comment.</span></p>
<p>Hi Francis,</p>
<p>In C Vu 11.3 you wrote an article on enums. You thought some
readers might be able to provide some constructive criticism...</p>
<p>I have a few typos...</p>
<pre class="programlisting">
struct programLimits { maxsize = 100 };  //??? struct --&gt; enum
enum X { zero, one two };  // missing comma between one and two
class myInt {
     myInt(int v = 0) : value(v) {}  // missing a public: specifier
     ...
namespace mathematicalConstants {{}
    class myDouble {
        myDouble(double v = 0) : value(v) {}  // missing public: specifier
        ...
    private:
    double value;
   // };    missing here
     myDouble const int pi = 3.14159265;
};  // spurious extra ; here
</pre>
<p>Also both conversion operators should be <tt class=
"literal">const</tt> qualified.</p>
<p>I would also say that I much prefer placing each new <tt class=
"literal">{</tt> on its own line. Obviously this is something of a
style issue, but remember the target audience are C++ newbies and
visual entity separation is very important. You might also consider
using <tt class="varname">initial_value</tt> instead of <tt class=
"varname">v</tt> as a parameter name</p>
<pre class="programlisting">
namespace math_Constants
{
     class my_Double
     {
     public:
          my_Double(double initial_value) : value(initial_value) { }
          operator double( ) const { return value; }
     private:
          double value;
     };
}
</pre>
<p>Jon Jagger <tt class="email">&lt;<a href=
"mailto:Jon.Jagger@qatraining.com">Jon.Jagger@qatraining.com</a>&gt;</tt></p>
<p class="c2"><span class="remark">Thanks. Interesting that you
picked up on the conversion operators which Kevlin missed. It is
theoretically possible to overload conversions on const. I wonder
whether that would ever be useful. On the subject of the parameter
name, I would opt for something like yours in a prototype
(declaration) but would choose the short option in a definition.
Layout? Well let us not get into that debate.</span></p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
