<html>

<head>
<title>Remove Deprecated iostreams aliases</title>
<style type="text/css">
  p {text-align:justify}
  li {text-align:justify}
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
</style>
</head>

<body>
<table>
<tr>
  <td align="left">Doc. no.</td>
  <td align="left">P0004R1</td>
</tr>
<tr>
  <td align="left">Date:</td>
  <td align="left">2015-10-19</td>
</tr>
<tr>
  <td align="left">Project:</td>
  <td align="left">Programming Language C++</td>
</tr>
<tr>
  <td align="left">Reply to:</td>
  <td align="left">Alisdair Meredith &lt;<a href="mailto:ameredith1@bloomberg.net">ameredith1@bloomberg.net</a>&gt;</td>
</tr>
</table>

<h1>Remove Deprecated iostreams aliases</tt></h1>

<h2><a name="0.0">Revision History</a></h2>

<h3><a name="0.1">Revision 0</a></h3>
<p>
Original version of the paper for the 2015 pre-Kona mailing.
</p>

<h3><a name="0.2">Revision 1</a></h3>
<p>
Added a compatibility clause for LWG review.
</p>

<h2><a name="1.0">I. Table of Contents</a></h2>
<ul>
<li><a href="#0.0">Revision History</a></li>
  <ul>
  <li><a href="#0.1">Revision 0</a></li>
  <li><a href="#0.2">Revision 1</a></li>
  </ul>
<li><a href="#1.0">I. Table of Contents</a></li>
<li><a href="#2.0">II. Introduction</a></li>
<li><a href="#3.0">III. Motivation and Scope</a></li>
<li><a href="#4.0">IV. Compatibility</a></li>
<li><a href="#5.0">V. Impact On the Standard</a></li>
<li><a href="#6.0">VII. Technical Specification</a></li>
<li><a href="#7.0">VII. References</a></li>
</ul>


<h2><a name="2.0">II. Introduction</a></h2>

<p>
Annex D.6 Old iostreams members [depr.ios.members] contains a number of aliases
for types and functions in the iostreams library facility for compatibility
with similar pre-standard libraries.  They were deprecated in the original 1998
C++ standard, and it is time to formally remove them.
</p>


<h2><a name="3.0">III. Motivation and Scope</a></h2>

<p>
As the C++ standard grows larger, there is an incremental cost in maintaining
pages of obsolete features.  This was acknowledged at the Urbana meeting with
the removal of several deprecated library clauses, such <tt>auto_ptr</tt> and
the classic function binders.  The the list of references at the end of this
document for a list of other deprecated features expected to be removed from
the next version of the standard.
</p>

<p>
This paper proposes the removal of some names that are purely aliases of
existing library names, that many readers of the standard are not aware of due
to their presence only in the deprecated features annex, and not actually
present in their corresponding class definitions in clause 27.
</p>

<p>
This paper specifically does <em>not</em> recommend removing clause D.7 though,
the <tt>strstream</tt> library.  That proposal has been made several times
before, and rejected each time for lack of a replacement feature to solve the
same problems as efficiently.
</p>


<h2><a name="4.0">IV. Compatibilty</a></h2>

<p>
There will likely be an impact on legacy user code that has not been updated to
modernize use of these names in the ~20 years they will have been deprecated
when the next standard is released.  However, it is expected to be a much lower
impact than the already approved removal of <tt>auto_ptr</tt> and the classic
function binders.
</p>

<p>
None of the functions are virtual, so there should be no ABI compatibilty
issues.  As with any library change, there is always a risk that the specific
identifiers presence or absence could be detected with SFINAE trickery (such as
the recently adopted <tt>void_t</tt>) which may be observable through an ABI,
but such concerns would inhibit all changes to the standard library, and would
be considered an even lower risk than usual in this case, as the names are
intended only for compatibility with code that predates the discovery of
SFINAE-based reflection.
</p>


<h2><a name="5.0">V. Impact On the Standard</a></h2>

<p>
The impact on the standard is minimal, as no other part of the standard assumes
these names exist.
</p>


<h2><a name="6.0">VI. Technical Specifications</a></h2>

<p>
Strike the entirety of Annex D.6 Old iostream members [depr.ios.members].
</p>

<h2><del>D.6 Old iostreams members [depr.ios.members]</del></h2>

<p><del>
1 The following member names are in addition to names specified in Clause 27:
</del></p>
<p><code><pre>
     <del>namespace std {</del>
       <del>class ios_base {</del>
       <del>public:</del>
         <del>typedef <i>T1</i> io_state;</del>
         <del>typedef <i>T2</i> open_mode;</del>
         <del>typedef <i>T3</i> seek_dir;</del>
         <del>typedef <i>implementation-defined</i> streamoff;</del>
         <del>typedef <i>implementation-defined</i> streampos;</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>
     <del>}</del>
</pre></code></p>
<p><del>
2 The type <tt>io_state</tt> is a synonym for an integer type (indicated here as <tt><i>T1</i></tt> ) that permits
certain member functions to overload others on parameters of type <tt>iostate</tt> and provide the same behavior.
</del></p>
<p><del>
3 The type <tt>open_mode</tt> is a synonym for an integer type (indicated here as <tt><i>T2</i></tt> ) that permits
certain member functions to overload others on parameters of type <tt>openmode</tt> and provide the same behavior.
</del></p>
<p><del>
4 The type <tt>seek_dir</tt> is a synonym for an integer type (indicated here as <tt><i>T3</i></tt> ) that permits
certain member functions to overload others on parameters of type <tt>seekdir</tt> and provide the same behavior.
</del></p>
<p><del>
5 The type <tt>streamoff</tt> is an implementation-defined type that satisfies the requirements of off_type in 27.2.2.
</del></p>
<p><del>
6 The type <tt>streampos</tt> is an implementation-defined type that satisfies the requirements of pos_type in 27.2.2.
</del></p>
<p><del>
7 An implementation may provide the following additional member function, which has the effect of calling
<tt>sbumpc()</tt> (27.6.3.2.3):
</del></p>
<p><code><pre>
     <del>namespace std {</del>
       <del>template&lt;class charT, class traits = char_traits&lt;charT&gt; &gt;</del>
       <del>class basic_streambuf {</del>
       <del>public:</del>
         <del>void stossc();</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>
     <del>}</del>
</pre></code></p>
<p><del>
8 An implementation may provide the following member functions that overload signatures specified in Clause 27:
</del></p>
<p><code><pre>
     <del>namespace std {</del>
       <del>template&lt;class charT, class traits&gt; class basic_ios {</del>
       <del>public:</del>
         <del>void clear(io_state state); void setstate(io_state state); void exceptions(io_state);</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>

       <del>class ios_base {</del>
       <del>public:</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>

       <del>template&lt;class charT, class traits = char_traits&lt;charT&gt; &gt;</del>
       <del>class basic_streambuf {</del>
       <del>public:</del>
         <del>pos_type pubseekoff(off_type off, ios_base::seek_dir way,</del>
                   <del>ios_base::open_mode which = ios_base::in | ios_base::out);</del>
         <del>pos_type pubseekpos(pos_type sp,</del>
                   <del>ios_base::open_mode which);</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>

       <del>template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;</del>
       <del>class basic_filebuf : public basic_streambuf&lt;charT,traits&gt; {</del>
       <del>public:</del>
         <del>basic_filebuf&lt;charT,traits&gt;* open</del>
         <del>(const char* s, ios_base::open_mode mode);</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>

       <del>template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;</del>
       <del>class basic_ifstream : public basic_istream&lt;charT,traits&gt; {</del>
       <del>public:</del>
         <del>void open(const char* s, ios_base::open_mode mode);</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>

       <del>template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;</del>
       <del>class basic_ofstream : public basic_ostream&lt;charT,traits&gt; {</del>
       <del>public:</del>
         <del>void open(const char* s, ios_base::open_mode mode);</del>
         <del><i>// remainder unchanged</i></del>
       <del>};</del>
     <del>}</del>
</pre></code></p>
<p><del>
9 The effects of these functions is to call the corresponding member function specified in Clause 27.
</del></p>


<p>
Insert the following compatibility clause into Annex C:
</p>

<h3><ins><a name="6.1">C.4.2 Annex D: compatibility features [diff.cpp14.depr]</a></ins></h3>
<p><ins>D.6</ins></p>
<p><ins><b>Change:</b> Remove old iostreams members [depr.ios.members].</ins></p>
<p><ins><b>Rationale:</b> Redundant feature for compatibility with pre-standard code has served its time.</ins></p>
<p><ins><b>Effect on original feature:</b> A valid C++ 2014 program using these identifiers may be ill-formed
in this International Standard.
</ins></p>


<h2><a name="7.0">VII. References</a></h2>
<ul>
  <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4086">N4086</a> Removing trigraphs??!, Richard Smith</li>
  <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4168">N4168</a> Removing <tt>auto_ptr</tt>, Billy Baker</li>
  <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190">N4190</a> Removing <tt>auto_ptr</tt>, <tt>random_shuffle()</tt>, And Old <tt>&lt;functional&gt;</tt> Stuff, Stephan T. Lavavej</li>
  <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0001r0.html">P0001R0</a> Remove Deprecated Use of the <tt>register</tt> Keyword</li>
  <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0002r0.html">P0002R0</a> Remove Deprecated <tt>operator++(bool)</tt></li>
</ul>

</body>

</html>
