    <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  :: Francis' Scribbles</title>
        <link>https://members.accu.org/index.php/journals/1149</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>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 14, #1 - Feb 2002 + Francis' Scribbles from CVu journal</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/journals/">All</a>

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

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

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c116/">141</a>
                    (8)
<br />

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

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c184/">Journal Columns</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c181/">Francis' Scribbles</a>
                    (29)
<br />

                                            <a href="https://members.accu.org/index.php/journals/c116-181/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c116+181/">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;Francis' Scribbles</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 February 2002 13:15:49 +00:00 or Sun, 03 February 2002 13:15:49 +00: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>A Little
History</h2>
</div>
<p>Soon after becoming editor of C Vu I received an invitation from
the editor of .EXE Magazineto write a short regular column about C.
I think my first one appeared in January 1990. At that time I was
limited to 500 words. Soon after, Mike Banahan, Chair of the
European C++ User Group, was given the other half of the page to
write 500 Words on C++. In those days I sometimes dropped my column
in preference to a more substantial item on a new compiler release
or other relevant item. After a year, Mike decided that he did not
want to continue and I found myself with a whole page. When Will
Watts stopped editing .EXE I found myself acquiring two pages for
my column (about 2000 words) with the freedom to write about
whatever interested me in the world of C &amp; C++ Programming.
That column continued till the death of EXE - the dot had got lost
somewhere along the way. <i class="citetitle">C++ Report</i> ceased
publication in the same month. That left me with more time and a
substantial hole in my budget - the EXE column funded my Standards
work.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e26" id="d0e26"></a>Looking
Forward</h2>
</div>
<p>Now, having also shed my work as editor of C Vu, and being in
the process of phasing out my work as production editor I find
myself with a little time to write a regular column. I intend to
model it on my EXE Column, that is as long as you, the readers,
enjoy it that way.</p>
<p>I will include a short coding problem in each column and after
the first one I will also give you my answerto the previous one. It
will be nothing as complicated as Herb Sutter's Guru of the week
items, just a little problem to stretch our brain cells. If you
want to discuss it on one of ACCU's mailing lists, that will be
fine, but please also include editor@accu.org in the loop so that
James can convert suitable items for use in C Vu.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e33" id="d0e33"></a>C &amp; C++ or
C/C++</h2>
</div>
<p>The problem with writing 'C/C++' is that it implies that there
is some kind of fusion between the two languages. There is enough
commonality in syntax and semantics so that we can write source
code that will compile to do the same thing. However there are many
little differences as well as some big ones that makes such code
something that has to be written with care.</p>
<p>I have become increasingly conscious that the use of 'C/C++'
creates a mental attitude towards programming in these languages
that is fundamentally flawed. That is why I am advocating that
people stop referring to the two languages that way and replace it
with 'C &amp; C++'. You may think the change is too small to
signify but I disagree. The exact way we express ourselves often
carries hidden messages. Think of the implications of 'talk to' as
opposed to 'talk with'. The real change takes place in the
speaker/writer who consciously chooses between the two. The
reader/listener may not note the difference but even then they may
be subtly influenced.</p>
<p>If you have a view on this please send it to the editor but copy
it to me because I will be interested whether you agree or not.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e42" id="d0e42"></a>Book of the
Year 2001</h2>
</div>
<p>Over the past few years I have selected a book from the year's
publications for my 'Book of the Year'. I have been surprised to
find how much some authors treasure that personal statement.
However I think the time has come for us to move on and make this
selection one that you, the members of ACCU, participate in. The
way I propose to make it work is as follows:</p>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e47" id="d0e47"></a>Step 1</h3>
</div>
<p>As soon as you can after reading this, and certainly not later
than March 1<sup>st</sup> send in your nominations for:</p>
<p><span class="emphasis"><em>All Time C Programming
Book:</em></span> no limit to publication date but one exclusion,
K&amp;R is excluded. Otherwise you may nominate any book that is
purely on C or purely C related regardless of publication date.</p>
<p><span class="emphasis"><em>C++ Programming Book of
2001:</em></span> nominated books must have a 2001 copyright date
(check because some books are actually released with copyright
dates for the previous or following year.</p>
<p><span class="emphasis"><em>Hall of Fame:</em></span> nominate
any author whose published works (at least three published books)
have made an outstanding contribution to the art of programming. I
think we may allow more than one winner in this category for the
first year we run it.</p>
<p><span class="emphasis"><em>Worst Book of 2001:</em></span> this
one will be difficult because only the unlucky ones among you will
have read really bad books, but give it a go. We probably will not
embarrass you by actually voting on this list.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e71" id="d0e71"></a>Step 2</h3>
</div>
<p>I will publish the qualifying nominations in the next issue of C
Vu. You, the readers will then get to vote and the results will be
published in the following issue.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e76" id="d0e76"></a>step 2A</h3>
</div>
<p>I will also hold a separate vote at the ACCU Spring Conference
2002.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e81" id="d0e81"></a>Summary</h3>
</div>
<p>I think it will be interesting to see both what books are
nominated and how the two overlapping electorates cast their votes.
However the most important thing is for as many people as possible
to participate. I would hope that at least 25% of the ACCU
membership makes at least one nomination in one of the categories.
If you read one or more good books last year, one way to thank the
author is to nominate the book or books. You can nominate more than
one book. When I see how many books have been nominated in each
category I will decide what will be the fairest way to vote on the
over all winner.</p>
</div>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e86" id="d0e86"></a>Conference</h2>
</div>
<p>I believe that we have a conference programme for the ACCU
Spring Conference 2002 that is second to none anywhere in the
World. When you couple that with a cost that is cut to the bone
(the whole four days costs less than some events charge for a day)
I think you can understand why I think that it is the one event
that every one should strive to attend. If costs are a serious
problem then check the offer made in the last issue of C Vu. No one
who takes their programming seriously should miss this event.</p>
<p>I realise that in reality there are many reasons why some will
miss this event, but where there is a will there is a way. Just go
and look at the speaker line-up. Most people just look incredulous
when I say that I expect the World's best speakers to come to our
event because they think we could not possibly afford to pay them.
Well we can't, but that is not an issue because they are willing to
speak just for the pleasure of being involved. If you truly want
something you can get it. I wanted the best conference in the
World, and I am half way there, the other half is up to you.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e93" id="d0e93"></a>Shrink-Wrapped
Idiocy</h2>
</div>
<p>I just have to share this with you out of sheer frustration with
the way that our good work can be messed up by the marketing and
sales people.</p>
<p>I was setting up a new system with XP for a client (and I agree
with my son, XP is by far the best operating system that MS have
produced. That is not to say that it is perfect but...) and they
wanted Roxio's Creative CD installed (though XP has direct support
for CDR/RW).</p>
<p>I checked on the web and found that the software provided had to
be patched. I got the patch. All was fine so far.</p>
<p>I installed the software from the CD and thoughtlessly rebooted
before installing the patch. Bad, bad move. On reboot XP declined
to load the drivers on the grounds they were not compatible, nor
would it load its own drivers. No doubt given time, I could have
worked out what to do next but the obvious solution seemed to be to
uninstall Roxio's product.</p>
<p>No can do. The uninstall needs to read the installation CD. This
is not the first time I have encountered such lunacy but it really
is down right stupid. Apart from anything else, how does an honest
parent remove pirated software from a child's machine?</p>
<p>As I had not done anything other than install XP, the simple
answer was to reinstall everything from scratch.</p>
<p>Now if you work for a company producing shrink-wrapped software
could I suggest that you check to see that those people in the
front office are not lowering the customer perception of your work
by doing silly things like this.</p>
<p>Just to give you another example, the Harry Potter game does not
seem to install correctly on anything but the C drive. Maybe there
was some other problem but that was the way it looked to me. Very
irritating because I try to restrict what goes on my C drive to
those things that have to be there for technical reasons rather
than because some idiot cannot write correct and robust (un)install
routines.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e112" id=
"d0e112"></a>comp.lang.c++.moderated</h2>
</div>
<p>Some of you may know that I recently became a moderator for the
above newsgroup. It is quite interesting, though sometimes a little
tedious. The most likely culprits for flaming etc. are actually
very well respected and knowledgeable experts which means that one
has to carefully read everything before accepting it.</p>
<p>In general it seems that I usually top the monthly lists of
posts to the group closely followed by James Kanze. Actually James
writes far more than I do because he is a proponent of the long and
fully responsive post while I tend to be overly terse. This cosy
position was broken by a newcomer. He burst on the scene with what
he claimed was his first ever attempt at writing a class and was
also a fabulously (my word, not his) fast implementation of a
subset of the string specification. The trouble is that the
moderation procedure does not allow us to reject posts just because
the writer is an aggressively enthusiastic idiot with a completely
overblown concept of his ability.</p>
<p>If you want to see just how stupid someone who claims to be a
professional C programmer with fifteen years of experience can be
wander over to Google and have a look, you won't have much problem
with finding his posts but I cannot mention his name because the
editor thinks that is unfair. You won't want to look at many of the
posts before tedium sets in. He mentioned that he only had about
three months before he would have to find some more employment. The
response from one reader (which was never posted because it was a
manifest flame) was to tell him that he should a) Persuade Google
to remove all his posts from their archives and b) only post to the
web with a well-disguised alias.</p>
<p>Now the irony is that in all his 'bull in a china shop'
thrashing around he managed to highlight a problem with
Dinkumware's implementation of <tt class=
"classname">std::string</tt> related to how they handled assignment
and reserved memory. PJ Plauger had done something apparently
sensible (in the broader context) which really killed performance
if you tried to append lots of single bytes. Once the problem
surfaced it was quick for one of the other library experts to point
to a better solution. However you can just imagine what that did to
the original poster's ego.</p>
<p>The moral is that even the most stupid person can sometimes
identify a problem. I am very much in favour of listening to
novices because they bring a new perspective that sometimes let the
more experienced gain insight. However, how much better it is when
they show respect for the skills of others. Arguing with David
Abrahams as to the meaning of <span class="emphasis"><em>the strong
exception safe guarantee</em></span> just shows ignorance.
Continuing to argue when told that the term was actually invented
by David is just plain rude.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e131" id="d0e131"></a>Thoughts on
Ownership</h2>
</div>
<p>Is it not curious that so many people confuse the tool with the
problem? I get tired of reading advice that basically says that
classes that have pointers as data members need user written copy
constructors, copy assignments and destructors. Such a requirement
has nothing to do with pointers, though their presence is often an
indication that resource ownership needs to be considered.</p>
<p>The fundamental problem is that when an object owns resources
we, as programmers, have to handle that ownership. There are two
places where the problems will be most visible, when copying and
when destroying the object.</p>
<p>These days it would be rare to find an experienced C++
programmer who used a raw pointer as a handle for some dynamically
acquired resource. Instead we would use some form of smart pointer
whose destructor released the resource. The simplest pointer for
such purposes is an <tt class="classname">auto_ptr</tt>. And if we
want a dynamically allocated array, a <tt class=
"classname">std::vector</tt> (or possibly a <tt class=
"classname">basic_string</tt>) would seem to be the tool of
choice.</p>
<p>Using this kind of tool solves two problems: it deals with some
of the exception safety issues that pertain to constructors by
ensuring that acquired resources are correctly released if the
constructor fails, it also makes it likely that you may be able to
avoid writing a destructor. It does not fix the problems of
copying.</p>
<p>One of the things that programmers need to learn about is
copying and the variety of semantics that can be attached to the
process.</p>
<p>In the case of <tt class="classname">auto_ptr</tt> we have a
strict ownership semantics based on the concept that only one thing
can own the resource. Copying in those terms means transfer of
ownership. Actually that is not what most of us think of as being
copying, but how else do you deal with a unique resource? Well
there is another solution which is shared ownership and various
manifestations of this concept are found in <tt class=
"classname">counted_ptr</tt>, <tt class="classname">shared_ptr</tt>
etc. But notice that using such smart pointers involves a very
exact concept of ownership, which again provides a
counter-intuitive version of copying. If you intend that all copies
of an object share a resource then fine, but it may have hidden
implications when you start moving into multi-threaded code.</p>
<p>If you want to automate copying of objects that own resources
you will need another kind of pointer, one with deep copy
semantics. I.e. one where the process of copying the pointer copies
the object pointed to.</p>
<p>No doubt there are other issues that I have not considered but
the point that I want to make is that just knowing the idiom of
using <tt class="classname">auto_ptr</tt> or <tt class=
"classname">vector</tt> instead of a raw pointer obscures the
underlying design issues. To deal correctly with resources you need
to understand ownership in a way that is far more fundamental than
that presented in most books and courses. In addition these are not
C++ issues but programming ones. C++ provides a good set of tools
for dealing with ownership issues. To use the tools correctly you
must understand the issues.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e174" id="d0e174"></a>Evolving
C++</h2>
</div>
<p>Is there anything that you think you wish C++ did that it does
not do at the moment? Or perhaps there is something that can be
done but only by pushing general coding skills to the limit.</p>
<p>I often hear people say that library fixes are to be preferred
to language ones on the basis that you do not need to fiddle with
the compiler. I can understand that, because changing the language
has to be done very carefully lest a seemingly small change has
unforeseen consequences elsewhere.</p>
<p>However, library fixes are not cost free. Sometimes they involve
very convoluted use of template technology that expands compilation
times and makes source code more fragile.</p>
<p>I think we should be looking at ways to simplify code so that
writing correct code becomes easier. Indeed if you look at general
technological development you will see that things go in cycles. We
start with something that is very simple and then progressively
complicate it. Then there comes a new grand simplification. If you
think carefully you may come to the conclusion that the original
attraction of C++ (in the mid 1980s) was just that it allowed
writing C like code to be done more simply. And then we went
through over a decade of complicating it.</p>
<p>I think it is time we looked for new simplifications. Curiously
extending the language can simplify it by allowing us to express
more complex ideas and intentions in simpler ways.</p>
<p>On the other hand we can simplify things for application
programmers by providing them with more powerful and more extensive
libraries. Libraries that have been well designed and thoroughly
tested before being added to the standard. This is part of the
reason for the existence of boost.org.</p>
<p>I wonder what criteria you would have for deciding how we should
add elements to the Standard C++ Library. In the past people have
been reluctant to consider giving library support where there is
more than one reasonable approach. For example random number
generators are far from simple because you need to consider such
things as distributions (rectangular, normal etc.) as well as
simple ideas as to quality of randomness.</p>
<p>However the work of people such as Andrei Alexandrescu with his
policy parameterised templates show that we can provide such things
and allow each person to have something that exactly meets their
needs.</p>
<p>On the other hand things that would appear to be cost free prove
to be otherwise when we investigate further. For example it seems
perfectly reasonable to extend the language by providing compiler
generated virtual destructors for any class that has a virtual
function.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
