    <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  :: The Casting Vote I</title>
        <link>https://members.accu.org/index.php/articles/1452</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 #17/18 - Jan 1997</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/c228/">1718</a>
<br />

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

                    -                        <a href="https://members.accu.org/index.php/articles/c65+228/">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;The Casting Vote I</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 31 January 1997 08:57:00 +00:00 or Fri, 31 January 1997 08:57:00 +00:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<p> In my last column I said that we were poised on the brink
of a critical decision: to ship the second Committee Draft after the
Hawaii meeting. We succeeded. That means that a sec-ond ANSI public
review is about to start and each National Body will study the draft to
de-cide its vote in the forthcoming ballot.</p>
<p> The most important effect of shipping CD2 is stability. In
Kona in November the committee made very few changes that were anything
but editorial. Our charter for the meeting was to clear all our issues
lists and create the CD. The latter was particularly unusual: normally
the committee vote to accept a bunch of changes and a small team edit
them into the working paper after the meeting and the resulting
document is approved at the next meeting. In Kona, we voted on a few
changes in the middle of the meeting and used the next day to
pro-duce the new working paper. This left us with only two
motions on Friday: accepting the team managed the job very smoothly.</p>
<h2>Those final changes</h2>
<p> In theory, very few of the changes accepted in Kona are
likely to affect the average pro-grammer. We're mostly fixing the
dark cor-ners of the language now but there were a few
clarifications that have slightly wider impact.</p>
<h2>Now you see it...</h2>
<p> The language change that I was most con- cerned about was
access checking the delete operator. If you've read what the draft
stan-dard says about this, you'll probably agree that it is
virtually unimplementable, effectively re-quiring runtime checks
that would place a high overhead on implementations. The Core I
sub-group considered various ways to clarify this and finally
settled on the following:</p>
<ul>
  <li>When a destructor is defined, a publicly accessible, unambiguous
    <span style="font-family: monospace;">operator delete()</span> must
be found (which can include the global
    <span style="font-family: monospace;">operator delete()</span>).</li>
</ul>
<p> What concerns me about this change is that it breaks the
idiom of making a base class <span style="font-family: monospace;">operator
delete()</span> private in order
to restrict the dynamic memory operations used on a class&#8212;derived class
destructors will be ill-formed because the visible <span
 style="font-family: monospace;">operator delete()</span> is not
accessible. I sat in on this discussion: there did not
appear to be a reasonable solution that still respected access control
so I guess we'll have to live with this one.</p>
<h2>Can you point to it?</h2>
<p>The other change which bothered me and bothered the UK
sufficiently to vote &quot;no&quot; on submitting CD2 - is a library change. The
working paper is very vague about allocator classes. The intent is that
an allocator encapsu-lates memory allocation and deallocation for a
particular memory model (e.g., near, far, huge on Intel architectures).
The concept of &quot;memory model&quot; is a broad one and can be taken to
encompass shared memory, persistent memory and so on. The allocators
described in the working paper supported this, in theory, by having
member types for <span style="font-family: monospace;">pointer</span>
and <span style="font-family: monospace;">reference</span>, allowing
managed memory
that is accessible via smart pointers.</p>
<p>I say &quot;in theory&quot; because in practice the working paper was
so vague about <span style="font-family: monospace;">pointer</span>
and <span style="font-family: monospace;">reference</span> that some
people argued that it
was unimplementable. This was compounded by the fact that allocators
are intended to be objects and that the working paper implied that
containers must carry around these objects as part of their internal
data structures some container operations were very poorly
specified in this area.</p>
<p>I, and a few others, argued that the draft was clear enough
but you just might not like what it said! In the end, after some heated
exchanges and hard bargaining, allocators were crippled but not beyond
recovery. What CD2 says of allocators is:</p>
<ul>
  <li><span style="font-family: monospace;">reference </span>is always
    <span style="font-family: monospace;">T&amp; </span>because C++
does not support smart references, <br>
  </li>
  <li>the standard containers are only guaranteed to work with
allocators whose <span style="font-family: monospace;">pointer </span>type
is <span style="font-family: monospace;">T*</span>,</li>
  <li>the standard containers are only guaranteed to work with
allocators whose in-stances compare equal <span
 style="font-weight: bold;">and</span> are interchangeable.</li>
</ul>
<p>I have no real problem with the restriction on <span
 style="font-family: monospace;">reference
</span>although it precludes conforming extensions (such things are
possible,
if rather exotic). The restriction on pointer means that you cannot
write an allocator for shared mem-ory, for example, and have it
work with the standard template library. The restriction on instances
makes it extremely hard to write effi-cient allocators that handle
more than one arena of memory.</p>
<p>Despite the claims of unimplementability, I have allocators
that work with shared memory and I have containers that work with those
allo-cators. Allowing for limitations of current compilers, these
allocators and containers are intended to be standard conforming: the
change at Kona has effectively broken my code. I believe very strongly
that the standard template library should provide better
guaran-tees of operation with user-supplied allocators. All is not
lost, however, since I intend to work with Matt Austern - one of the
authors of the proposal that introduced the restrictions - to specify
requirements on <span style="font-family: monospace;">pointer </span>and,
hopefully, instances that will allow
the restrictions to be relaxed during the resolution of CD2
com-ments.</p>
<h2>The next step</h2>
<p>Expect to see smaller and smaller columns in this series as
the committee move into &quot;minutiae mode&quot;. Our next meeting is in Nashua,
NH and we will be reviewing com-ments from the public review and
any that have been forwarded from National Bodies. I sus-pect that
most of the public comments will be requests for extensions and they
will therefore be rejected - the time for change has passed!</p>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
