Commit d8867564 by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/14991 (stream::attach(int fd) porting entry out-of-date)

2007-01-13  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/14991
	* docs/html/17_intro/porting-howto.html ([3]): Mention stdio_filebuf.
	* docs/html/17_intro/porting-howto.xml: Remove.

	* docs/html/17_intro/porting-howto.html: Remove spurious end tags
	pointed out by validator.w3.org.

From-SVN: r120749
parent 8bcd6380
2007-01-13 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/14991
* docs/html/17_intro/porting-howto.html ([3]): Mention stdio_filebuf.
* docs/html/17_intro/porting-howto.xml: Remove.
* docs/html/17_intro/porting-howto.html: Remove spurious end tags
pointed out by validator.w3.org.
2007-01-12 Paolo Carlini <pcarlini@suse.de> 2007-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/30416 (continued) PR libstdc++/30416 (continued)
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
with this</a> with this</a>
</dt> </dt>
</dl></dd> </dl></dd>
<dt>2. <a href="#sec-nocreate">there is no ios::nocreate/ios::noreplace <dt>2. <a href="#sec-nocreate">There is no ios::nocreate/ios::noreplace
in ISO 14882</a> in ISO 14882</a>
</dt> </dt>
<dt>3. <a href="#sec-stream::attach">stream::attach(int <dt>3. <a href="#sec-stream::attach">stream::attach(int
...@@ -182,7 +182,6 @@ ...@@ -182,7 +182,6 @@
<b>std::cout</b>) =&gt; can always be used <b>std::cout</b>) =&gt; can always be used
</p></li> </p></li>
</ul></div> </ul></div>
</p>
<p> <p>
Because there are many compilers which still use an implementation Because there are many compilers which still use an implementation
that does not have the standard C++-library in namespace that does not have the standard C++-library in namespace
...@@ -235,7 +234,6 @@ ...@@ -235,7 +234,6 @@
libstdc++ in <b>std::</b> or not). (ideas from libstdc++ in <b>std::</b> or not). (ideas from
<tt>&lt;<a href="mailto:llewelly@dbritsch.dsl.xmission.com">llewelly@dbritsch.dsl.xmission.com</a>&gt;</tt>, Karl Nelson <tt>&lt;<a href="mailto:llewelly@dbritsch.dsl.xmission.com">llewelly@dbritsch.dsl.xmission.com</a>&gt;</tt>, Karl Nelson
<tt>&lt;<a href="mailto:kenelson@ece.ucdavis.edu">kenelson@ece.ucdavis.edu</a>&gt;</tt>) <tt>&lt;<a href="mailto:kenelson@ece.ucdavis.edu">kenelson@ece.ucdavis.edu</a>&gt;</tt>)
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h3 class="title"> <div class="titlepage"><div><h3 class="title">
...@@ -248,7 +246,6 @@ ...@@ -248,7 +246,6 @@
namespace std { } namespace std { }
using namespace std; using namespace std;
</pre> </pre>
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h3 class="title"> <div class="titlepage"><div><h3 class="title">
...@@ -270,7 +267,7 @@ ...@@ -270,7 +267,7 @@
</pre> </pre>
(thanks to Juergen Heinzl who posted this solution on (thanks to Juergen Heinzl who posted this solution on
gnu.gcc.help) gnu.gcc.help)
</p></li> </li>
<li><p> <li><p>
Define a macro NS_STD, which is defined to Define a macro NS_STD, which is defined to
either &quot;&quot; or &quot;std&quot; either &quot;&quot; or &quot;std&quot;
...@@ -280,8 +277,6 @@ ...@@ -280,8 +277,6 @@
systems that do not put string in std::. (This is untested) systems that do not put string in std::. (This is untested)
</p></li> </p></li>
</ul></div> </ul></div>
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h3 class="title"> <div class="titlepage"><div><h3 class="title">
...@@ -356,7 +351,7 @@ ...@@ -356,7 +351,7 @@
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
<a name="sec-nocreate"></a>there is no ios::nocreate/ios::noreplace <a name="sec-nocreate"></a>There is no ios::nocreate/ios::noreplace
in ISO 14882</h2></div></div> in ISO 14882</h2></div></div>
<p> <p>
I have seen <b>ios::nocreate</b> being used for I have seen <b>ios::nocreate</b> being used for
...@@ -384,21 +379,7 @@ ...@@ -384,21 +379,7 @@
descriptors. Of those that do, not all of them use integers to represent descriptors. Of those that do, not all of them use integers to represent
them. them.
</p> </p>
<p>
When using libstdc++-v3, you can use
<div class="funcsynopsis">
<pre class="funcsynopsisinfo">
#include &lt;fstream&gt;
</pre>
<p><code><code class="funcdef">
<b class="fsfunc">basic_filebuf&lt;...&gt;::basic_filebuf&lt;...&gt;
</b>
</code>(<var class="pdparam">file</var>, <var class="pdparam">mode</var>, <var class="pdparam">size</var>);<br>__c_file_type* <var class="pdparam">file</var>;<br>ios_base::open_mode <var class="pdparam">mode</var>;<br>int <var class="pdparam">size</var>;</code></p>
</div>
but the the signature of this constructor has changed often, and
it might change again. For the current state of this, check
<a href="../ext/howto.html" target="_top">the howto for extensions</a>.
</p>
<p> <p>
For a portable solution (among systems which use For a portable solution (among systems which use
filedescriptors), you need to implement a subclass of filedescriptors), you need to implement a subclass of
...@@ -409,6 +390,14 @@ ...@@ -409,6 +390,14 @@
<a href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a> <a href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a>
by Nicolai Josuttis. by Nicolai Josuttis.
</p> </p>
<p>
An extension is also available:
<code>&lt;ext/stdio_filebuf.h&gt;</code> contains a derived class called
<a href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/class____gnu__cxx_1_1stdio__filebuf.html"><code>__gnu_cxx::stdio_filebuf</code></a>.
This class can be constructed from a C <code>FILE*</code> or a file
descriptor, and provides the <code>fd()</code> function.
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
...@@ -491,7 +480,6 @@ ...@@ -491,7 +480,6 @@
more =&gt; use <b>if (iterator != iterator_type())</b> more =&gt; use <b>if (iterator != iterator_type())</b>
?</p></li> ?</p></li>
</ul></div> </ul></div>
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
...@@ -518,7 +506,6 @@ ...@@ -518,7 +506,6 @@
std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int) std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int)
_ISspace ) ; _ISspace ) ;
</pre> </pre>
</p>
<p> <p>
One solution I can think of is to test for -v3 using One solution I can think of is to test for -v3 using
autoconf-macros, and define macros for each of the C-functions autoconf-macros, and define macros for each of the C-functions
...@@ -537,7 +524,6 @@ ...@@ -537,7 +524,6 @@
[ now include &lt;ctype.h&gt; ] [ now include &lt;ctype.h&gt; ]
</pre> </pre>
</p>
<p> <p>
Another problem arises if you put a <b>using namespace Another problem arises if you put a <b>using namespace
std;</b> declaration at the top, and include <tt>&lt;ctype.h&gt;</tt>. This will result in std;</b> declaration at the top, and include <tt>&lt;ctype.h&gt;</tt>. This will result in
...@@ -598,7 +584,6 @@ ...@@ -598,7 +584,6 @@
</pre> </pre>
If you are using other (non-GNU) compilers it might be a good idea If you are using other (non-GNU) compilers it might be a good idea
to check for <b>string::at</b> separately. to check for <b>string::at</b> separately.
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
...@@ -611,7 +596,6 @@ ...@@ -611,7 +596,6 @@
#define CPP_EOF EOF #define CPP_EOF EOF
#endif #endif
</pre> </pre>
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
...@@ -637,7 +621,6 @@ ...@@ -637,7 +621,6 @@
implemented in gcc 2.95.x's libstdc++, so you should use implemented in gcc 2.95.x's libstdc++, so you should use
<b>erase</b> (which is probably faster than <b>erase</b> (which is probably faster than
<b>operator=(charT*)</b>). <b>operator=(charT*)</b>).
</p>
</div> </div>
<div class="section"> <div class="section">
<div class="titlepage"><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><h2 class="title" style="clear: both">
...@@ -678,7 +661,6 @@ ...@@ -678,7 +661,6 @@
(clear(); str(input);) (clear(); str(input);)
</p></li> </p></li>
</ul></div> </ul></div>
</p>
<p> <p>
You can then use output-stringstreams like this: You can then use output-stringstreams like this:
<pre class="programlisting"> <pre class="programlisting">
...@@ -701,7 +683,6 @@ ...@@ -701,7 +683,6 @@
oss.freeze(false); oss.freeze(false);
#endif #endif
</pre> </pre>
</p>
<p> <p>
Input-stringstreams can be used similarly: Input-stringstreams can be used similarly:
<pre class="programlisting"> <pre class="programlisting">
...@@ -743,7 +724,6 @@ ...@@ -743,7 +724,6 @@
} }
</pre> </pre>
Another example of using stringstreams is in <a href="../21_strings/howto.html" target="_top">this howto</a>. Another example of using stringstreams is in <a href="../21_strings/howto.html" target="_top">this howto</a>.
</p>
<p> <p>
I have read the Josuttis book on Standard C++, so some information I have read the Josuttis book on Standard C++, so some information
comes from there. Additionally, there is information in comes from there. Additionally, there is information in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment